Bugzilla – Bug 130435
chemtool is miscompiled
Last modified: 2005-10-25 10:04:30 UTC
For details see: Bug #122542 - chemtool segmentation fault
Please provide some details on why you think the patch in comment #7 of #122542 fixes a gcc bug.
It doesn't fix any gcc bug, it just stop exposing it. Try running chemtool on 10.0-i386 and chemtool crashes in the for-cycle for (i = 0; i < 7; i++) when fontsizelabel[i] is read, because i has some random value: (gdb) bt #0 0x407e2d9b in strlen () from /lib/tls/libc.so.6 #1 0x404e92ae in g_strdup () from /opt/gnome/lib/libglib-2.0.so.0 #2 0x40151fe7 in gtk_label_set_text () from /opt/gnome/lib/libgtk-x11-2.0.so.0 #3 0x40084152 in gtk_accel_label_new () from /opt/gnome/lib/libgtk-x11-2.0.so.0 #4 0x401701dc in gtk_menu_item_new_with_label () from /opt/gnome/lib/libgtk-x11-2.0.so.0 #5 0x0805882d in main (argc=1, argv=0xbfd47ec4) at main.c:5062 (gdb) f 5 #5 0x0805882d in main (argc=1, argv=0xbfd47ec4) at main.c:5062 5062 fontsizeitem[i] = gtk_menu_item_new_with_label (fontsizelabel[i]); (gdb) p i $1 = 822097201 (gdb) I compiled main.c with gcc -O2 -Wall -Wunused -Wuninitialized --save-temps -I. -DGTK2 -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/X11R6/include -I/usr/include/libpng12 -I/opt/gnome/include/gtk-2.0 -I/opt/gnome/lib/gtk-2.0/include -I/opt/gnome/include/atk-1.0 -I/opt/gnome/include/pango-1.0 -I/opt/gnome/include/glib-2.0 -I/opt/gnome/lib/glib-2.0/include -DHAVE_CONFIG_H -DLOCALEDIR=\"/usr/local/share/locale\" -c -o main.o main.c (will attache main.i in a minute)
Created attachment 55302 [details] preprocessed main.c
That backtrace doesn't show anthing interesting - i is probably not accurate here because of debug info deficiencies. Likewise (gdb) print i $2 = 135719928 (gdb) print fontsizelabel $1 = {0x31003531 <Address 0x31003531 out of bounds>, 0x37310036 <Address 0x37310036 out of bounds>, 0x383100 <Address 0x383100 out of bounds>, 0x8003931 <Address 0x8003931 out of bounds>, 0x80866d9 "17", 0x809fbb3 "20", 0x8084c44 "24"}
I'm reducing and investigating nevertheless.
Your bug. (gdb) print bondtypes $4 = 20 char bondnums[15][3]; for (i = 0; i < bondtypes; i++) { int ii = i; menuitem = gtk_menu_item_new(); gtk_menu_append (GTK_MENU (bondmenu), menuitem); gtk_widget_show (menuitem); snprintf (bondnums[i],3, "%d", ii);