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.
--
Summary: [4.3 Regression] Possible miscompilation on MIPS
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tbm at cyrius dot com
GCC target triplet: mips-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34415