Question about glibmm/Glib::ustring::format




Hi,

I believe this is the correct list for glibmm related questions.

I am having an issue with a program crashing, which uses libglibmm. I
believe I've narrowed the problem down to Glib::ustring::format, and made
a simple test program. When the test program runs it crashes.

glibmm on this machine is glibmm-2.4

The compiler is clang, however I seem to get the same results using gcc 4.8.

Here's my sample test and results:

#include <iostream>
#include <iomanip>
#include <glibmm.h>

int main() {

        double value = 22.0 / 7.0;
        std::cout << value << std::endl;
        Glib::ustring test =
Glib::ustring::format(std::fixed,std::setprecision(2),value);
        std::cout << test << std::endl;

}


$ clang++ -o testglib `pkg-config --cflags --libs glibmm-2.4` testglib.cpp
$ ./testglib
3.14286
Abort trap (core dumped)


$ /usr/local/bin/gdb testglib
GNU gdb (GDB) 7.6.2 [GDB v7.6.2 for FreeBSD]
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd11.0".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/home/waitman/testglib...done.
(gdb) run
Starting program: /usr/home/waitman/testglib
[New LWP 100327]
3.14286
[New Thread 803006400 (LWP 100327)]

Program received signal SIGABRT, Aborted.
[Switching to Thread 803006400 (LWP 100327)]
0x0000000801e313ba in kill () from /lib/libc.so.7
(gdb) bt
#0  0x0000000801e313ba in kill () from /lib/libc.so.7
#1  0x0000000801e30069 in abort () from /lib/libc.so.7
#2  0x00000008016ce7da in ?? () from /lib/libcxxrt.so.1
#3  0x000000080085de68 in Glib::ConvertError::throw_func(_GError*) ()
   from /usr/local/lib/libglibmm-2.4.so.1
#4  0x000000080086ed2f in Glib::Error::throw_exception(_GError*) ()
   from /usr/local/lib/libglibmm-2.4.so.1
#5  0x000000080087bcc2 in Glib::ustring::FormatStream::to_string() const ()
   from /usr/local/lib/libglibmm-2.4.so.1
#6  0x0000000000401de0 in Glib::ustring::format<std::__1::ios_base&
(std::__1::ios_base&), std::__1::__iom_t5, double>(std::__1::ios_base& (
const&)(std::__1::ios_base&), std::__1::__iom_t5 const&, double const&) (
    a1= 0x401e50: {std::__1::ios_base &(std::__1::ios_base &)} 0x401e50
<std::__1::fixed(std::__1::ios_base&)>, a2=..., a3= 0x7fffffffd860:
3.1428571428571428)
    at /usr/local/include/glibmm-2.4/glibmm/ustring.h:1158
#7  0x0000000000401696 in main () at testglib.cpp:9
(gdb)


maybe relevant information?

$ uname -a
FreeBSD akira.waitman.net 11.0-CURRENT FreeBSD 11.0-CURRENT #1 r261643:
Sat Feb  8 22:11:05 PST 2014    
root akira waitman net:/usr/obj/usr/src/sys/AKIRA  amd64

$ ldd testglib
testglib:
        libglibmm-2.4.so.1 => /usr/local/lib/libglibmm-2.4.so.1 (0x80081e000)
        libgobject-2.0.so.0 => /usr/local/lib/libgobject-2.0.so.0 (0x800a9d000)
        libglib-2.0.so.0 => /usr/local/lib/libglib-2.0.so.0 (0x800cea000)
        libintl.so.9 => /usr/local/lib/libintl.so.9 (0x800ff2000)
        libsigc-2.0.so.0 => /usr/local/lib/libsigc-2.0.so.0 (0x8011fb000)
        libc++.so.1 => /usr/lib/libc++.so.1 (0x801400000)
        libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x8016be000)
        libm.so.5 => /lib/libm.so.5 (0x8018d8000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x801b00000)
        libc.so.7 => /lib/libc.so.7 (0x801d0d000)
        libffi.so.6 => /usr/local/lib/libffi.so.6 (0x80208a000)
        libgmodule-2.0.so.0 => /usr/local/lib/libgmodule-2.0.so.0 (0x802291000)
        libpcre.so.3 => /usr/local/lib/libpcre.so.3 (0x802494000)
        libthr.so.3 => /lib/libthr.so.3 (0x8026fb000)



I've tried various tests from examples which use ::format, they all seem
to crash. Does anyone have any idea/suggestions for troubleshooting?

Thank you,


-- 
Waitman Gobble
San Jose California USA
+1.510-830-7975



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]