From: Charles W. <cwi...@us...> - 2010-01-26 02:54:56
|
Cesar Strauss wrote: > Charles Wilson wrote: >> However, after I worked through those, I ended up with a >> build that coredumps if -O3, but works (mostly) at -O0. > > Intriguing. I will investigate when I get a chance. > > First thing is to reproduce your results. I will report back when it's done. Well, you'll need a few additional packages: I've rebuilt all the prereqs using the new toolchain -- including gdbm (*). Plus, there are some changes to the buildscript/patchset even for old perl-5.6.1 (the -mms-bitfields thing and similar stuff) as I mentioned before. I can tar all that up and post it somewhere for you, but it'll be a day or two. OTOH, some news: it appears to be an optimizer bug in building *msys-1.0.dll*. When I rebuild msys using the 3.4.4-3 toolchain, at -O3 or -O2, then I see the behavior described. When I build it at -O0 or -O1, I do not (but note, in these tests I do NOT rebuild perl. I simply drop in the new msys DLL). This explains the "but when I use msys-1.0-debug.dll, it works" -- the -debug DLL is always built at -O0. So now the question becomes, what is OLD perl doing differently, such that it somehow can call the same function exported from the "broken" -O3/-O2 dll, and have it work correctly? And, what is -O2/-O3 doing that breaks this function in such an interesting way? Some possibilities (fixed in 3.4.5 upstream): http://gcc.gnu.org/gcc-3.4/changes.html#3.4.5 Optimizations issues * 17810 ICE in verify_local_live_at_start * 17860 Wrong generated code for loop with varying bound * 21709 ICE on compile-time complex NaN * 21964 broken tail call at -O2 or more * 22167 Strange optimization bug when using -Os * 22619 Compilation failure for real_const_1.f and real_const_2.f90 * 23241 Invalid code generated for comparison of uchar to 255 * 23478 Miscompilation due to reloading of a var that is also used in EH pad * 24470 segmentation fault in cc1plus when compiling with -O * 24950 ICE in operand_subword_force I'm thinking that 17860 (-fstrength-reduce) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17860 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.906&r2=2.2326.2.907 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/loop.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.488.2.8&r2=1.488.2.9 21964 (tail recursion) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21964 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.904&r2=2.2326.2.905 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/stmt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.342.2.3&r2=1.342.2.4 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.419&r2=1.3389.2.420 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/pr21964-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.4.1 22167 (-Os problem) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22167 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.882&r2=2.2326.2.883 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/gcse.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.288.2.9&r2=1.288.2.10 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.406&r2=1.3389.2.407 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/pr22167.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.4.1 23241 ("uchar vs. 255") http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23241 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.905&r2=2.2326.2.906 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/combine.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.400.4.14&r2=1.400.4.15 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.420&r2=1.3389.2.421 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/char-compare.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.4.1 23478 ("caller-save bug") http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23478 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.912&r2=2.2326.2.913 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/regs.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.31.4.1&r2=1.31.4.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/local-alloc.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.126.4.1&r2=1.126.4.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/flow.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.572.4.4&r2=1.572.4.5 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/global.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.98&r2=1.98.4.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.426&r2=1.3389.2.427 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/pr23478.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.4.1 might bear investigation. I'll try turning on the individual optimizations in -O2 one at a time -- starting with -fstrength-reduce -- until I find the one that causes this bug to appear (I hope it's not a /combination/ of optimizations...) Here's the list of optimizations that /this version/ of gcc enables at -O2 but not at -O1 on /this target/: $ echo 'int c;' > test.c $ gcc -fverbose-asm -save-temps -O2 test.c -S -o - | tr ' ' '\n' |\ sed -n '/^-/p' | sort > testO2.l $ gcc -fverbose-asm -save-temps -O1 test.c -S -o - | tr ' ' '\n' |\ sed -n '/^-/p' | sort > testO1.l $ diff testO1.l testO2.l | sed -n '/^> /s/^> //p' -fcaller-saves -fcrossjumping -fcse-follow-jumps -fcse-skip-blocks -fdelete-null-pointer-checks -fexpensive-optimizations -fforce-mem -fgcse -foptimize-register-move -foptimize-sibling-calls -fpeephole2 -fregmove -freorder-blocks -freorder-functions -frerun-cse-after-loop -frerun-loop-opt -fschedule-insns2 -fstrength-reduce <<< bug #17860 -fstrict-aliasing -funit-at-a-time -- Chuck |