Bug 130435 - chemtool is miscompiled
Summary: chemtool is miscompiled
Status: RESOLVED INVALID
Alias: None
Product: SUSE LINUX 10.0
Classification: openSUSE
Component: Development (show other bugs)
Version: Final
Hardware: x86 Other
: P5 - None : Normal
Target Milestone: ---
Assignee: Richard Biener
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-25 06:25 UTC by Andreas Jaeger
Modified: 2005-10-25 10:04 UTC (History)
1 user (show)

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
preprocessed main.c (202.53 KB, application/x-gzip)
2005-10-25 09:29 UTC, Michal Marek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Jaeger 2005-10-25 06:25:48 UTC
For details see:
Bug #122542 - chemtool segmentation fault
Comment 1 Richard Biener 2005-10-25 09:03:39 UTC
Please provide some details on why you think the patch in comment #7 of #122542 fixes a gcc bug.
Comment 2 Michal Marek 2005-10-25 09:28:07 UTC
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)


Comment 3 Michal Marek 2005-10-25 09:29:30 UTC
Created attachment 55302 [details]
preprocessed main.c
Comment 4 Richard Biener 2005-10-25 09:37:19 UTC
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"}
Comment 5 Richard Biener 2005-10-25 10:00:12 UTC
I'm reducing and investigating nevertheless.
Comment 6 Richard Biener 2005-10-25 10:04:30 UTC
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);