[forwarded from http://bugs.debian.org/195911] rechecked with 3.3 CVS 20030626 and HEAD CVS 20030531 While compiling XFree86 CVS with gcc-3.3 it compiles fine with default optimization flags; but trying to compile with -Os results in undefined symbols in shared libraries (i.e. this problem is only seen with -fPIC and not otherwise) such as .L99. The problem was narrowed down to the compilation of a few files e.g. xc/lib/Xaw/SimpleMenu.c, xc/lib/dps/dpsXclient.c A check of assembly code shows that .L99 was being called with it being absent; with -O2 it was present. Same problem comes with undefined .L92 in xc/lib/Xaw6/SimpleMenu.c Attaching the preprocessed source (.i and .s) in a followup.
Created attachment 4291 [details] preprocessed source
Created attachment 4292 [details] generated .s file
command line used: gcc -save-temps -c -g -Os -g -ansi -pedantic -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wundef -I../../lib/Xaw -I../.. -I../../exports/include -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DFUNCPROTO=15 -DNARROWPROTO -DHAS_WCHAR_H -DHAS_WCTYPE_H -DNO_WIDEC_H -DOLDXAW -fPIC SimpleMenu.c
Created attachment 4293 [details] Reduced one but not all the way A reduced one which removes all the functions that is not used but keeps PositionMenuAction where the problem is. This should be reduced more but I can confirm this has a problem on the mainline (20030626).
Created attachment 4295 [details] still not all the way but only 143 left Almost a reduced case but still needs some work.
I cannot cut it down lower than 34 lines (removing any thing more will just cause gcc to produce the right code: typedef struct { short x, y; } XPoint; typedef struct { int type; int x_root, y_root; } XEvent; typedef struct _WidgetRec *Widget; Widget FindMenu(Widget); void PositionMenu(Widget, XPoint*); void PositionMenuAction(Widget, XEvent*); void PositionMenuAction(Widget w, XEvent *event) { Widget menu; XPoint loc; if ((menu = FindMenu(w)) == ((void *)0)) return; switch (event->type) { case 4: case 5: loc.x = event->x_root; loc.y = event->y_root; PositionMenu(menu, &loc); break; case 7: case 8: loc.x = event->x_root; loc.y = event->y_root; PositionMenu(menu, &loc); break; case 6: loc.x = event->x_root; loc.y = event->y_root; PositionMenu(menu, &loc); break; } }
*** Bug 10934 has been marked as a duplicate of this bug. ***
Should have been for target 3.3.1 (I had forgot to move it). Another thing is it fails with 3.2.2 but does not with 3.2.3.
Yet another lost tablejump.
Postponed until GCC 3.3.2.
It looks like this is fixed with Jim Wilson's alias.c patch(?), at least I am unable to reproduce the failure on the 20030812 3.3 branch.
please ignore the last comment, wrong PR ...
*** Bug 11920 has been marked as a duplicate of this bug. ***
Postponed until GCC 3.3.3.
RTH -- You've been assigned this bug. Do you have plan for it? -- Gaby
The reduced case does not fail on the mainline any more but the non reduced case does at -O1 -fPIC.
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-01/msg00791.html>.
(In reply to comment #17) > Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-01/msg00791.html>. So RTH, what is your final word?
Subject: Re: [3.3/3.4 regression] undefined labels with -Os -fPIC On Wed, Jan 14, 2004 at 08:15:12AM -0000, gdr at gcc dot gnu dot org wrote: > > Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-01/msg00791.html>. > > So RTH, what is your final word? Not having a test case on hand that will fail because of this patch, I guess I'll approve it. I do seem to recall problems in the other direction but I can't point to them.o r~
Subject: Bug 11350 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: rth@gcc.gnu.org 2004-01-16 11:07:19 Modified files: gcc : ChangeLog cfgcleanup.c cfgrtl.c Log message: PR opt/11350 * cfgcleanup.c (try_optimize_cfg): Suppress tablejump removal after reload. * cfgrtl.c (try_redirect_by_replacing_branch): Likewise. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.883&r2=1.16114.2.884 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cfgcleanup.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.68.2.9&r2=1.68.2.10 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cfgrtl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.61.2.13&r2=1.61.2.14
Subject: Bug 11350 CVSROOT: /cvs/gcc Module name: gcc Changes by: rth@gcc.gnu.org 2004-01-16 11:30:51 Modified files: gcc : ChangeLog cfgcleanup.c cfgrtl.c Log message: PR opt/11350 * cfgcleanup.c (try_optimize_cfg): Suppress tablejump removal after reload. * cfgrtl.c (rtl_can_merge_blocks, cfglayout_can_merge_blocks, rtl_try_redirect_by_replacing_branch): Likewise. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.2320&r2=2.2321 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cfgcleanup.c.diff?cvsroot=gcc&r1=1.98&r2=1.99 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cfgrtl.c.diff?cvsroot=gcc&r1=1.102&r2=1.103
Committed Jan's patch to both mainline and 3.3.