[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333 Andrew Pinski changed: What|Removed |Added Status|WAITING |RESOLVED Resolution|--- |INVALID --- Comment #32 from Andrew Pinski --- As far as I can tell this is not a bug in GCC but a bug in their code where they have an extern inline function which behaviors differently the normal function.
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333 --- Comment #30 from Rafał Mużyło galtgendo at o2 dot pl 2013-01-06 02:20:08 UTC --- While 4.7.2 still has the problem, I've just learnt about PR33763. Now, while that particular patch doesn't help 4.7.2 - even it it sounds like it should - removing ' __attribute__ ((__always_inline__))' manually does make the code compile with '-O1'. So the question: does that patch not apply to -O1 level or is 'extern inline' and 'extern __inline' simply not being the same thing ? If it's the later, would a similar fix be applicable here too ?
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333 --- Comment #31 from Rafał Mużyło galtgendo at o2 dot pl 2013-01-06 03:34:17 UTC --- PS: the stripped down test case from PR33763 is quite alike attachment 25239, yet something makes a difference. extern void *bar (void); extern int baz (void); extern __inline __attribute__ ((__always_inline__))int baz (void) { return 2; } int baz (void) { return 1; } static void * inl (void) { int *f = (int *) __builtin_malloc (sizeof (int)); void *r = 0; *f = baz(); r = bar(); return r; } void * foo (void) { return inl (); }
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333 --- Comment #29 from Rafał Mużyło galtgendo at o2 dot pl 2012-06-17 13:17:36 UTC --- gcc 4.7.1 still shows inconsistent behavior with attachment 25239.
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333 Rafał Mużyło galtgendo at o2 dot pl changed: What|Removed |Added Attachment #25238|0 |1 is obsolete|| --- Comment #28 from Rafał Mużyło galtgendo at o2 dot pl 2011-09-11 14:55:09 UTC --- Created attachment 25239 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=25239 previous code, trimmed a bit more OK, I think that as far, as it can be trimmed. Now, somebody needs to figure out were things go wrong.
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333 --- Comment #27 from Rafał Mużyło galtgendo at o2 dot pl 2011-09-11 03:40:16 UTC --- Created attachment 25238 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=25238 prepocessed code of possibly related failure in gcc 4.6.1 OK, I'm not sure if comments from 24 on have anything to do with the original problem, but... https://bugs.gentoo.org/show_bug.cgi?id=365015 There you'll find an interesting testcase, that I've reduced to just this much preprocessed code - it fails with '-O1', succeeds with '-O2'. To be exact, it succeeds with '-O1 -fipa-cp'. What's more, it also succeeds, if '__attribute__ ((__always_inline__))' is removed. The exact failure: Using built-in specs. COLLECT_GCC=gcc-4.6.1 COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-pc-linux-gnu/4.6.1/lto-wrapper Target: i686-pc-linux-gnu Configured with: /mnt/workbox/builds/portage/sys-devel/gcc-4.6.1-r1/work/gcc-4.6.1/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.6.1 --includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.6.1/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.6.1 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.6.1/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.6.1/info --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.6.1/include/g++-v4 --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec --disable-fixed-point --with-ppl --with-cloog --disable-ppl-version-check --with-cloog-include=/usr/include/cloog-ppl --enable-lto --enable-nls --without-included-gettext --with-system-zlib --disable-werror --enable-secureplt --disable-multilib --enable-libmudflap --disable-libssp --enable-libgomp --with-python-dir=/share/gcc-data/i686-pc-linux-gnu/4.6.1/python --enable-checking=release --disable-libgcj --with-arch=i686 --enable-objc-gc --enable-languages=c,c++,objc,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.6.1-r1 p1.0, pie-0.4.5' --disable-libstdcxx-pch Thread model: posix gcc version 4.6.1 (Gentoo 4.6.1-r1 p1.0, pie-0.4.5) COLLECT_GCC_OPTIONS='-v' '-Wall' '-O1' '-c' '-o' 'fprintf-bug0-4.6.o' '-save-temps' '-mtune=generic' '-march=i686' /usr/libexec/gcc/i686-pc-linux-gnu/4.6.1/cc1 -fpreprocessed fprintf-bug0-4.6.i -quiet -dumpbase fprintf-bug0-4.6.i -mtune=generic -march=i686 -auxbase-strip fprintf-bug0-4.6.o -O1 -Wall -version -o fprintf-bug0-4.6.s GNU C (Gentoo 4.6.1-r1 p1.0, pie-0.4.5) version 4.6.1 (i686-pc-linux-gnu) compiled by GNU C version 4.6.1, GMP version 5.0.2, MPFR version 3.0.1-p4, MPC version 0.8.2 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C (Gentoo 4.6.1-r1 p1.0, pie-0.4.5) version 4.6.1 (i686-pc-linux-gnu) compiled by GNU C version 4.6.1, GMP version 5.0.2, MPFR version 3.0.1-p4, MPC version 0.8.2 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 5f6717c7397ac8a626933ce7eb52 fprintf-bug0-4.6.i: In function ‘write_cfg’: fprintf-bug0-4.6.i:71:1: sorry, unimplemented: inlining failed in call to ‘fprintf’: indirect function call with a yet undetermined callee fprintf-bug0-4.6.i:78:7: sorry, unimplemented: called from here
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333 Dexuan Cui dexuan.cui at intel dot com changed: What|Removed |Added CC||dexuan.cui at intel dot com --- Comment #26 from Dexuan Cui dexuan.cui at intel dot com 2011-06-29 13:28:32 UTC --- (In reply to comment #24) I'm seeing this exact behaviour with 4.6 (r171422) with grub-0.97. Unfortunately again there is no self-contained test case. It appears stage2 is being miscompiled. At least, if I copy that file from a 4.5 build everything works. This is how I can reproduce it: - build grub-0.97. The object files are built like gcc -m32 -DHAVE_CONFIG_H -I. -I.. -I../stage1 -Wall -Wmissing-prototypes -Wunused -Wshadow -Wpointer-arith -falign-jumps=1 -falign-loops=1 -falign-functions=1 -Wundef -Os -fno-stack-protector -fno-builtin -nostdinc -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1 -DSUPPORT_GRAPHICS=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_UFS2=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 -DFSYS_VSTAFS=1 -DFSYS_JFS=1 -DFSYS_XFS=1 -DFSYS_ISO9660=1 -DUSE_MD5_PASSWORDS=1 -g -MT pre_stage2_exec-stage2.o -MD -MP -MF .deps/pre_stage2_exec-stage2.Tpo -c -o pre_stage2_exec-stage2.o `test -f 'stage2.c' || echo './'`stage2.c - after installation, run `grub-install /dev/sda` # grub-install /dev/sda GNU GRUB version 0.97 (640K lower / 9216K upper memory) [ Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists the possible completions of a device/filename. ] grub root (hd0,0) Filesystem type is ext2fs, partition type 0x83 grub setup --stage2=/boot/grub/stage2 --prefix=/grub (hd0) Checking if /grub/stage1 exists... yes Checking if /grub/stage2 exists... yes Checking if /grub/e2fs_stage1_5 exists... yes Running embed /grub/e2fs_stage1_5 (hd0)... 24 sectors are embedded. succeeded Running install --stage2=/boot/grub/stage2 /grub/stage1 (hd0) (hd0)1+24 p (hd0,0)/grub/stage2 /grub/menu.lst... failed Error 6: Mismatched or corrupt version of stage1/stage2 grub quit -fno-inline-small-functions works -fno-inline-small-functions -finline-functions works -fno-guess-branch-probability works -fno-ipa-profile works -fno-strict-aliasing works with -Os but not -O2 I understand this is impossible to debug. I'm just hoping it might spin some wheels. Grub isn't something we like to miscompile. ;) Let me know what other info/files would be useful. In poky we got the same issue: http://bugzilla.pokylinux.org/show_bug.cgi?id=1099. Thanks Ryan Hill for the investigation with grub-0.97 and gcc-4.6. Look forward to a formal fix in gcc...
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333 Ryan Hill dirtyepic at gentoo dot org changed: What|Removed |Added CC||dirtyepic at gentoo dot org --- Comment #24 from Ryan Hill dirtyepic at gentoo dot org 2011-03-26 07:31:02 UTC --- I'm seeing this exact behaviour with 4.6 (r171422) with grub-0.97. Unfortunately again there is no self-contained test case. It appears stage2 is being miscompiled. At least, if I copy that file from a 4.5 build everything works. This is how I can reproduce it: - build grub-0.97. The object files are built like gcc -m32 -DHAVE_CONFIG_H -I. -I.. -I../stage1 -Wall -Wmissing-prototypes -Wunused -Wshadow -Wpointer-arith -falign-jumps=1 -falign-loops=1 -falign-functions=1 -Wundef -Os -fno-stack-protector -fno-builtin -nostdinc -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1 -DSUPPORT_GRAPHICS=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_UFS2=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 -DFSYS_VSTAFS=1 -DFSYS_JFS=1 -DFSYS_XFS=1 -DFSYS_ISO9660=1 -DUSE_MD5_PASSWORDS=1 -g -MT pre_stage2_exec-stage2.o -MD -MP -MF .deps/pre_stage2_exec-stage2.Tpo -c -o pre_stage2_exec-stage2.o `test -f 'stage2.c' || echo './'`stage2.c - after installation, run `grub-install /dev/sda` # grub-install /dev/sda GNU GRUB version 0.97 (640K lower / 9216K upper memory) [ Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists the possible completions of a device/filename. ] grub root (hd0,0) Filesystem type is ext2fs, partition type 0x83 grub setup --stage2=/boot/grub/stage2 --prefix=/grub (hd0) Checking if /grub/stage1 exists... yes Checking if /grub/stage2 exists... yes Checking if /grub/e2fs_stage1_5 exists... yes Running embed /grub/e2fs_stage1_5 (hd0)... 24 sectors are embedded. succeeded Running install --stage2=/boot/grub/stage2 /grub/stage1 (hd0) (hd0)1+24 p (hd0,0)/grub/stage2 /grub/menu.lst... failed Error 6: Mismatched or corrupt version of stage1/stage2 grub quit -fno-inline-small-functions works -fno-inline-small-functions -finline-functions works -fno-guess-branch-probability works -fno-ipa-profile works -fno-strict-aliasing works with -Os but not -O2 I understand this is impossible to debug. I'm just hoping it might spin some wheels. Grub isn't something we like to miscompile. ;) Let me know what other info/files would be useful.
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333 --- Comment #25 from Ryan Hill dirtyepic at gentoo dot org 2011-03-26 08:04:14 UTC --- -fno-inline-small-functions works with -O2, not -Os.
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
--- Comment #20 from galtgendo at o2 dot pl 2009-04-22 00:04 --- Created an attachment (id=17669) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17669action=view) prepocessed source of id.c People, I've got a result, that's either very funny or very not funny. With the same compiler, with the command i686-pc-linux-gnu-gcc -std=gnu99 -O2 -march=athlon -mtune=athlon -pipe -fno-guess-branch-probability -I../lib -o id id.c group-list.o libver.a ../lib/libcoreutils.a id.c from coreutils 7.2 gets miscompiled, resulting in id -u always printing id: cannot print only of more than one choice The funny part is that without -fno-guess-branch-probability it works correctly, so it's the (sort of) opposite of above. I will shortly test, if things change with gcc 4.4.0. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
--- Comment #21 from galtgendo at o2 dot pl 2009-04-22 00:23 --- Well, with 4.4.0 id.c compiles correctly in both cases. Let's check the harder part. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
--- Comment #22 from galtgendo at o2 dot pl 2009-04-22 01:08 --- Well, gcc 4.4.0 works without '-fno-inline-small-functions' for freeciv too. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
--- Comment #23 from galtgendo at o2 dot pl 2009-04-22 01:15 --- comment 22 was of course about '-fno-guess-branch-probability', not the other one. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
--- Comment #19 from falk at debian dot org 2009-03-16 10:24 --- (In reply to comment #18) Well, I've got bad news for you anyway: it seems that the problem affects gcc-4.3.2 too: it seems it's reproducible in another app, however one potentially much harder to debug. Please read http://bugs.winehq.org/show_bug.cgi?id=17406 and give some ideas for a test. The fact that -fno-inline helps gives only very little indication that this is actually the same problem. In any case, I don't think there's really anything we can do without a complete test case (that is, a single file with a main() that exits with 0 when everything's fine and 1 otherwise). This is very difficult to do for someone who doesn't know the freeciv codebase. -- falk at debian dot org changed: What|Removed |Added Status|UNCONFIRMED |WAITING http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
--- Comment #18 from galtgendo at o2 dot pl 2009-03-07 14:06 --- Well, I've got bad news for you anyway: it seems that the problem affects gcc-4.3.2 too: it seems it's reproducible in another app, however one potentially much harder to debug. Please read http://bugs.winehq.org/show_bug.cgi?id=17406 and give some ideas for a test. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
--- Comment #16 from galtgendo at o2 dot pl 2009-03-07 04:30 --- OK, I've done a little test and I'd like to know, if it's results actually mean anything: I've compiled freeciv with CFLAGS=-O2 -finline-functions -fno-guess-branch-probability and it did not crash. Does the above confirm that the problem lies in -fguess-branch-probability ? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
Re: [Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
Sent from my iPhone On Mar 6, 2009, at 8:30 PM, galtgendo at o2 dot pl gcc-bugzi...@gcc.gnu.org wrote: --- Comment #16 from galtgendo at o2 dot pl 2009-03-07 04:30 --- OK, I've done a little test and I'd like to know, if it's results actually mean anything: I've compiled freeciv with CFLAGS=-O2 -finline-functions -fno-guess-branch-probability and it did not crash. Does the above confirm that the problem lies in -fguess-branch- probability ? Not really because that option only generates information used by other optimazations. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
--- Comment #17 from pinskia at gmail dot com 2009-03-07 04:35 --- Subject: Re: gcc 4.3.3 miscompiles when -finline-small-functions is used Sent from my iPhone On Mar 6, 2009, at 8:30 PM, galtgendo at o2 dot pl gcc-bugzi...@gcc.gnu.org wrote: --- Comment #16 from galtgendo at o2 dot pl 2009-03-07 04:30 --- OK, I've done a little test and I'd like to know, if it's results actually mean anything: I've compiled freeciv with CFLAGS=-O2 -finline-functions -fno-guess-branch-probability and it did not crash. Does the above confirm that the problem lies in -fguess-branch- probability ? Not really because that option only generates information used by other optimazations. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
--- Comment #11 from galtgendo at o2 dot pl 2009-03-03 15:15 --- Changing those two to unsigned doesn't help (I have checked that even before comment 8). Actually, I changed a few ints to unsigned wherever it looked sane for this file and it still crashed. What's more, '-O1' works and when I decided to go down the man page and test by -fno-* all of the features listed as additionally turned on by -O2 (-fthread-jumps -falign-functions -falign-jumps -falign-loops -falign-labels -fcaller-saves -fcrossjumping -fcse-follow-jumps -fcse-skip-blocks -fdelete-null-pointer-checks -fexpensive-optimizations -fgcse -fgcse-lm -foptimize-sibling-calls -fpeephole2 -fregmove -freorder-blocks -freorder-functions -frerun-cse-after-loop -fsched-interblock -fsched-spec -fschedule-insns -fschedule-insns2 -fstrict-aliasing -fstrict-overflow -ftree-pre -ftree-vrp) neither of them worked on its own. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
--- Comment #12 from galtgendo at o2 dot pl 2009-03-03 16:17 --- OK, a (perhaps) interesting result: '-fno-guess-branch-probability' works too, but as first to work was '-fno-inline-small-functions', this may simply be a case of this option making code big enough to hit inlining limit. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
--- Comment #13 from galtgendo at o2 dot pl 2009-03-03 16:22 --- On a not really related note: output of 'gcc -Q -O1 --help=optimizers' is quite inconsistent with the manpage. Among others, -finline-small-functions according to the manpage is turned on for -O1, -Q output claims the opposite. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
--- Comment #14 from hjl dot tools at gmail dot com 2009-03-03 17:01 --- Is there a testcase to show run-time error or compile-time error? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
--- Comment #15 from galtgendo at o2 dot pl 2009-03-03 21:13 --- It's a runtime error and there's no real testcase, as, for the time being, it's hard to say what exactly goes wrong. The only real analysis is in the upstream bug, but it's nothing conclusive (at least it doesn't seem that way). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
--- Comment #2 from pinskia at gcc dot gnu dot org 2009-03-02 13:52 --- Does -fno-strict-aliasing help ? Does -fno-strict-overflow help? -- pinskia at gcc dot gnu dot org changed: What|Removed |Added Component|c |middle-end http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
--- Comment #3 from galtgendo at o2 dot pl 2009-03-02 21:56 --- I'll check, but, as summary suggests (indirectly), '-O2 -fno-inline-small-functions' works just fine. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
--- Comment #4 from galtgendo at o2 dot pl 2009-03-02 22:20 --- Well, neither helps. As a sidenote: 'gcc -Q -O2 --help=optimizers' fails to list '-fstrict-overflow', -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
--- Comment #5 from pinskia at gcc dot gnu dot org 2009-03-02 22:43 --- (In reply to comment #3) I'll check, but, as summary suggests (indirectly), '-O2 -fno-inline-small-functions' works just fine. But that just enables more inlining. The problem is most likely somewhere else. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
--- Comment #6 from galtgendo at o2 dot pl 2009-03-03 00:20 --- (In reply to comment #5) But that just enables more inlining. The problem is most likely somewhere else. If so, why does '-O2' fail and '-O2 -fno-inline-small-functions' work ? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
--- Comment #7 from pinskia at gcc dot gnu dot org 2009-03-03 00:21 --- (In reply to comment #6) If so, why does '-O2' fail and '-O2 -fno-inline-small-functions' work ? Because you just disabled some extra inlining. try -O2 -fno-inline-small-functions -finline-functions and you will see that it still fails. -- Pinski -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
--- Comment #8 from galtgendo at o2 dot pl 2009-03-03 03:23 --- OK, we seem to misunderstand each other. Anyway, as '-Wall -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations' was set for all files during build and there were no warnings, the problem is probably non-trivial (though seeing just how much inlining is used is this file, I wouldn't be surprised, if it's 50/50 on gcc/freeciv). When I added '-Wextra', most of the new warnings were of either 'unused argument' or 'signed/unsinged comparison' type - in this file, there were no other. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
--- Comment #9 from galtgendo at o2 dot pl 2009-03-03 03:43 --- BTW, this is the workaround, that upstream created: http://svn.gna.org/viewcvs/freeciv/trunk/common/aicore/cm.c?rev=15556view=diffr1=15556r2=1p1=trunk/common/aicore/cm.cp2=/trunk/common/aicore/cm.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333
[Bug middle-end/39333] gcc 4.3.3 miscompiles when -finline-small-functions is used
--- Comment #10 from pinskia at gcc dot gnu dot org 2009-03-03 03:51 --- for (i = 0, j = 0; i lattice-size || forced_loop; i++) { i is signed and lattice-size is unsigned so there might be some wrapping. plus if (lattice-size 0) { will be changed into lattice-size != 0 . -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39333