Subject: optimizer problem in linux-mips gcc-3.2?

From: Guido Guenther <[email-masked]>
Date: Sun, 26 Jan 2003 22:59:42 +0100

Hi,
glibc's string/tester and string/inl-tester fail when compiled with
Debian's "gcc version 3.2.2 20030109 (Debian prerelease)" on linux-mips
(big endian) and -O2 or -Os. I've tried to strip down the testcase as
far as possible and suspect that gcc miscompiles it. It works fine with
Debian's "gcc version 2.95.4 20011002" and with the above gcc-3.2.2 and
optimations turned off, -O3 and -O1:

foo@bar:~$ gcc --save-temps -O2 tester.c && ./a.out
memccpy flunked test 8
0x10000100 is abcdefghr should be abcdefgh
1 errors.

foo@bar:~$ gcc --save-temps -Os tester.c && ./a.out 
memccpy flunked test 8
0x10000100 is abcdefghr should be abcdefgh
1 errors.

foo@bar:~$ gcc --save-temps -O3 tester.c && ./a.out 
0x10000100 is abcdefgh should be abcdefgh
No errors.

foo@bar:~$ gcc --save-temps -O0 tester.c && ./a.out 
0x10000100 is abcdefgh should be abcdefgh
No errors.

foo@bar:~$ gcc -O1 tester.c && ./a.out 
0x100000f0 is abcdefgh should be abcdefgh
No errors.

I've attache the testcase and the assembler output for -O2. Any help
greatly appreciated.
Regards,
 -- Guido

---

From: Eric Botcazou <[email-masked]>
Date: Mon, 27 Jan 2003 10:14:41 +0100

> optimations turned off, -O3 and -O1:

Fill in a bug report (see http://gcc.gnu.org/bugs.html).

-- 
Eric Botcazou