Try make CFLAGS="-g -O2 -fno-fast-math" and see if that fails like your test case 2. I *think* this will turn on the -O2 optimizations and disable fast-math. Other than that, I don't have any other suggestions.
HTH. -Shane On 7/8/08, Tom Epperly <[EMAIL PROTECTED]> wrote: > > Shane Harrelson wrote: > > You can find the same issue reported for Fedora from a few weeks ago: > > > > http://www.sqlite.org/cvstrac/tktview?tn=3186 > > > > Here's the original thread from the mailing list discussion: > > > > > http://sqlite.org:8080/cgi-bin/mailman/private/sqlite-dev/2008-June/000172.html > > > > -ffast_math was the culprit in this case as well. > > > [EMAIL PROTECTED]/tmp/sqlite-amalgamation-3.5.9]>gcc --version > gcc (Debian 4.3.1-4) 4.3.1 > Copyright (C) 2008 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > > I ran some tests. I configured with --disable-shared to avoid picking > up the Debian packages shared libsqlite3.so. > > 1. make CFLAGS="-g -O" clean sqlite3 ; ./sqlite3 foo "select 1.0 / > 3.0 ; " yields 0.33333333 as expected. > 2. make CFLAGS="-g -O2" clean sqlite3 ; ./sqlite3 foo "select 1.0 / > 3.0 ; " yields "" -- the bad situation. > 3. The GCC 4.3 manual shows the > > http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Optimize-Options.html#Optimize-Options > gives an explicit list of which optimizations -O2 turns on. I > wrote a simple "foreach" loop to try each additional optimization > by itself. -fschedule-insns seems to cause an internal GCC error. > $ foreach i (`cat opt_options `) > foreach? echo "Optimization: $i" > foreach? make CFLAGS="-g -O $i" clean sqlite3 > /dev/null > foreach? ./sqlite3 foo "select 1.0 / 3.0 ; " > foreach? end > Optimization: -fthread-jumps > 0.333333333333333 > Optimization: -falign-functions > 0.333333333333333 > Optimization: -falign-jumps > 0.333333333333333 > Optimization: -falign-loops > 0.333333333333333 > Optimization: -falign-labels > 0.333333333333333 > Optimization: -fcaller-saves > 0.333333333333333 > Optimization: -fcrossjumping > 0.333333333333333 > Optimization: -fcse-follow-jumps > 0.333333333333333 > Optimization: -fcse-skip-blocks > 0.333333333333333 > Optimization: -fdelete-null-pointer-checks > 0.333333333333333 > Optimization: -fexpensive-optimizations > 0.333333333333333 > Optimization: -fgcse > 0.333333333333333 > Optimization: -fgcse-lm > 0.333333333333333 > Optimization: -foptimize-sibling-calls > 0.333333333333333 > Optimization: -fpeephole2 > 0.333333333333333 > Optimization: -fregmove > 0.333333333333333 > Optimization: -freorder-blocks > 0.333333333333333 > Optimization: -freorder-functions > 0.333333333333333 > Optimization: -frerun-cse-after-loop > 0.333333333333333 > Optimization: -fsched-interblock > 0.333333333333333 > Optimization: -fsched-spec > 0.333333333333333 > Optimization: -fschedule-insns > shell.c: In function 'appendText': > shell.c:755: error: unable to find a register to spill in class 'AREG' > shell.c:755: error: this is the insn: > (insn 12 150 2 2 shell.c:723 (parallel [ > (set (reg:SI 1 dx [78]) > (unspec:SI [ > (mem:BLK (reg/f:SI 5 di [orig:80 zAppend ] > [80]) [0 A8]) (reg:QI 3 bx [82]) > (const_int 1 [0x1]) > (reg:SI 1 dx [81]) > ] 30)) > (clobber (reg/f:SI 5 di [orig:80 zAppend ] [80])) > (clobber (reg:CC 17 flags)) > ]) 810 {*strlenqi_1} (expr_list:REG_DEAD (reg:QI 3 bx [82]) > (expr_list:REG_DEAD (reg:SI 1 dx [81]) > (expr_list:REG_DEAD (reg/f:SI 5 di [orig:80 zAppend ] > [80]) > (expr_list:REG_UNUSED (reg/f:SI 5 di [orig:80 > zAppend ] [80]) > (expr_list:REG_UNUSED (reg:CC 17 flags) > (nil))))))) > shell.c:755: confused by earlier errors, bailing out > Preprocessed source stored into /tmp/ccl8qsNd.out file, please > attach this to your bugreport. > make: *** [shell.o] Error 1 > ./sqlite3: Command not found. > Optimization: -fschedule-insns2 > 0.333333333333333 > Optimization: -fstrict-aliasing > 0.333333333333333 > Optimization: -fstrict-overflow > 0.333333333333333 > Optimization: -ftree-pre > 0.333333333333333 > Optimization: -ftree-vrp > 0.333333333333333 > $ > 4. I tried -ffast-math too with make CFLAGS="-g -O -ffast-math" clean > sqlite3 > /dev/null ; ./sqlite3 foo "select 1.0 / 3.0; " > 0.333333333333333 > it yielded the correct answer > 5. According to the GCC 4.3 documentation, the following should be > equivalent to "-g -O2" but it also dies with an internal GCC error. > $ make CFLAGS="-g -O -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" clean > sqlite3 > /dev/null ; ./sqlite3 foo "select 1.0 / 3.0; " > shell.c: In function 'appendText': > shell.c:755: error: unable to find a register to spill in class 'CREG' > shell.c:755: error: this is the insn: > (insn:HI 12 2 4 2 shell.c:723 (parallel [ > (set (reg:SI 0 ax [78]) > (unspec:SI [ > (mem:BLK (reg/v/f:SI 5 di [orig:74 zAppend > ] [74]) [0 A8]) > (reg:QI 1 dx [82]) > (const_int 1 [0x1]) > (reg:SI 4 si [81]) > ] 30)) > (clobber (reg/f:SI 3 bx [orig:80 zAppend ] [80])) > (clobber (reg:CC 17 flags)) > ]) 810 {*strlenqi_1} (expr_list:REG_UNUSED (reg/f:SI 3 bx > [orig:80 zAppend ] [80]) > (expr_list:REG_UNUSED (reg:CC 17 flags) > (expr_list:REG_EQUAL (unspec:SI [ > (mem:BLK (reg/v/f:SI 5 di [orig:74 zAppend > ] [74]) [0 A8]) > (reg:QI 1 dx [82]) > (const_int 1 [0x1]) > (reg:SI 4 si [81]) > ] 30) > (nil))))) > shell.c:755: confused by earlier errors, bailing out > Preprocessed source stored into /tmp/ccXOGVKH.out file, please > attach this to your bugreport. > make: *** [shell.o] Error 1 > ./sqlite3: Command not found. > 6. If I drop -fschedule-insns from the list of optimizations, I get > the following: > $ make CFLAGS="-g -O -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-insns2 > -fstrict-aliasing -fstrict-overflow -ftree-pre -ftree-vrp" clean > sqlite3 > /dev/null ; ./sqlite3 foo "select 1.0 / 3.0; " > 0.333333333333333 > According to the GCC manual this is supposed to do all the > optimizations that -O2 does except -fschedule-insns. > > I am not sure what to make of all this. > > Tom > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users