The mawk test suite doesn't pass when I build mawk with gcc 4.3 at -O3 on mips. I cannot give you an isolated testcase but I've narrowed it down so that someone with more experience can take a look. I hope one of the two of you (David, Richard) can take a look. Get mawk from upstream or Debian and compile it normally. If you do: cp mawk test/mawk cd test ./mawk -f ../examples/decl.awk mawktest.dat | cmp -s - decl-awk.out ; echo $? cd .. you'll see that it works. Now do: cd rexp /usr/lib/gcc-snapshot/bin/gcc -g -Wall -O3 -DMAWK -I.. -c -o rexp0.o rexp0.c cd .. rm mawk make mawk and run the test above again and you'll see it fails. It fails because the whitespace is different, e.g. -hash: function returning unsigned (extern) +hash: function returning unsigned (extern) OK, we so know that something in rexp0.c doesn't work at -O3. Unfortunately at this point I don't have enough experience to investigate further. I found out one more thing, though. The testsuite works again (when rexp0.c is compiled with -O3) if you apply the following patch: +++ rexp/rexp0.c 2007-12-07 18:54:03.000000000 +0000 @@ -68,7 +68,7 @@ /* static functions */ int PROTO(do_str, (int, char **, MACHINE *)) ; int PROTO(do_class, (char **, MACHINE *)) ; -static int PROTO(escape, (char **)) ; +int PROTO(escape, (char **)) ; static BV *PROTO(store_bvp, (BV *)) ; static int PROTO(ctohex, (int)) ; @@ -576,7 +576,7 @@ on entry *s -> at the character after the slash *-------------------*/ -static int +int escape(start_p) char **start_p ; { I hope one of you can investigate. I'm not 100% sure this is a bug in GCC rather than in mawk, but mawk works fine on x86_64 when compiled with -O3. I've only seen the testsuite failure on MIPS so far.
Perhaps we could get a URL to a version of mawk that is failing. Also details about how you configured gcc and which svn revision number you tested, and how mawk was configured.
(In reply to comment #1) > Perhaps we could get a URL to a version of mawk that is failing. > > Also details about how you configured gcc and which svn revision number you > tested, and how mawk was configured. It's all standard Debian stuff. apt-get source mawk will give you mawk (1.3.3-11). apt-get install gcc-snapshot will give you a compiler based on trunk (sid)tbm@appdev:~/src/mawk-1.3.3$ /usr/lib/gcc-snapshot/bin/gcc -v Using built-in specs. Target: mips-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 20071030-1' --with-bugurl=file:///usr/share/doc/gcc-snapshot/README.Bugs --enable-languages=c,c++,obj-c++ --prefix=/usr/lib/gcc-snapshot --enable-shared --with-system-zlib --disable-nls --enable-clocale=gnu --enable-libstdcxx-debug --disable-libssp --disable-werror --build=mips-linux-gnu --host=mips-linux-gnu --target=mips-linux-gnu Thread model: posix gcc version 4.3.0 20071030 (experimental) [trunk revision 127646] (Debian 20071030-1)
As of the experience with the removed 'static' keyword it is very likely that the function where escape() is inlined to is miscompiled.
Confirmed.
This is a bug in the delayed branch scheduler. Patch here: http://gcc.gnu.org/ml/gcc-patches/2007-12/msg00506.html
Subject: Bug 34415 Author: rsandifo Date: Sun Dec 16 09:54:34 2007 New Revision: 130987 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130987 Log: gcc/ PR rtl-optimization/34415 * df.h (DF_LR_IN, DF_LR_OUT): Update comments. * resource.c (mark_target_live_regs): Use DF_LR_IN rather than df_get_live_in. Don't handle pseudos. gcc/testsuite/ PR rtl-optimization/34415 * gcc.c-torture/execute/pr34415.c: New test. Added: trunk/gcc/testsuite/gcc.c-torture/execute/pr34415.c Modified: trunk/gcc/ChangeLog trunk/gcc/df.h trunk/gcc/resource.c trunk/gcc/testsuite/ChangeLog
Fixed on trunk.