This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
gcc 2.95.2 20000313 mistranslation
- To: gcc-bugs at gcc dot gnu dot org
- Subject: gcc 2.95.2 20000313 mistranslation
- From: bglbv at my-deja dot com
- Date: Mon, 1 May 2000 21:54:33 +0100
[Trying again without the oversized attachment. You can download it from
http://www.dur.ac.uk/~dph1sg/boxrelations.i.gz (for a limited time only).]
The platform is Debian GNU/Linux 2.2, x86, Debian package gcc-2.95.2-9.
I have found an instance of gcc miscompiling a loop in source
code for the Amaya web browser. I am attaching file boxrelations.i
as per the bug reporting guidelines. The loop is at lines 54160-54175
of that file (2372-2387 of the original source). Specifically, the
compiler fails to reload register %ecx with the correct value at .LM1068
below. (Aside: I also fail to see the point of clobbering %ecx at .LM1066.)
The result is a series of out-of-bounds accesses at .LM1063-5 on the
next iteration. (Thanks to electric-fence for catching this.)
.stabn 68,0,2372,.LM1061-RemovePosRelation
.LM1061:
cmpl $9,%edx
jg .L1249
movl -4(%ebp),%ebx
movl -36(%ebp),%ecx
addl $-12,%ecx
.p2align 4,,7
.L1250:
.stabn 68,0,2374,.LM1062-RemovePosRelation
.LM1062:
leal 1(%edx),%esi
.stabn 68,0,2375,.LM1063-RemovePosRelation
.LM1063:
movl 16(%ebx,%ecx),%eax
movl %eax,4(%ebx,%ecx)
.stabn 68,0,2376,.LM1064-RemovePosRelation
.LM1064:
movl 20(%ebx,%ecx),%edx
movl %edx,8(%ebx,%ecx)
.stabn 68,0,2377,.LM1065-RemovePosRelation
.LM1065:
movl 24(%ebx,%ecx),%edx
movl %edx,12(%ebx,%ecx)
.stabn 68,0,2379,.LM1066-RemovePosRelation
.LM1066:
movl $108,%ecx
movl $10,%edx
.stabn 68,0,2378,.LM1067-RemovePosRelation
.LM1067:
testl %eax,%eax
je .L1248
.stabn 68,0,2382,.LM1068-RemovePosRelation
.LM1068:
movl $120,%ecx
movl %esi,%edx
.stabn 68,0,2384,.LM1069-RemovePosRelation
.LM1069:
cmpl $10,%edx
jne .L1248
.stabn 68,0,2385,.LM1070-RemovePosRelation
.LM1070:
movl $0,112(%ebx)
.stabn 68,0,2387,.LM1071-RemovePosRelation
.LM1071:
.L1248:
cmpl $9,%edx
jle .L1250
Here is how I compiled this file:
gcc -v -save-temps -g -O2 -W -DHAVE_CONFIG_H -I.. -I../../amaya/xpm -I../../tablelib/f -I../../thotlib/include -I../../thotlib/internals/var -I../../thotlib/internals/h -I../../thotlib/internals/f -I../../schemas -I../../schemasOPERA -I../../libpng -I../../libpng/zlib -I/usr/X11R6/include -I/usr/X11R6/include -c ../../thotlib/view/boxrelations.c -o view/boxrelations.o
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.2/specs
gcc version 2.95.2 20000313 (Debian GNU/Linux)
/usr/lib/gcc-lib/i386-linux/2.95.2/cpp -lang-c -v -I.. -I../../amaya/xpm -I../../tablelib/f -I../../thotlib/include -I../../thotlib/internals/var -I../../thotlib/internals/h -I../../thotlib/internals/f -I../../schemas -I../../schemasOPERA -I../../libpng -I../../libpng/zlib -I/usr/X11R6/include -I/usr/X11R6/include -D__GNUC__=2 -D__GNUC_MINOR__=95 -D__ELF__ -Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__OPTIMIZE__ -g -W -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -DHAVE_CONFIG_H ../../thotlib/view/boxrelations.c boxrelations.i
GNU CPP version 2.95.2 20000313 (Debian GNU/Linux) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
..
../../amaya/xpm
../../tablelib/f
../../thotlib/include
../../thotlib/internals/var
../../thotlib/internals/h
../../thotlib/internals/f
../../libpng
../../libpng/zlib
/usr/X11R6/include
/usr/local/include
/usr/lib/gcc-lib/i386-linux/2.95.2/include
/usr/include
End of search list.
The following default directories have been omitted from the search path:
/usr/lib/gcc-lib/i386-linux/2.95.2/../../../../include/g++-3
/usr/lib/gcc-lib/i386-linux/2.95.2/../../../../i386-linux/include
End of omitted list.
/usr/lib/gcc-lib/i386-linux/2.95.2/cc1 boxrelations.i -quiet -dumpbase boxrelations.c -g -O2 -W -version -o boxrelations.s
GNU C version 2.95.2 20000313 (Debian GNU/Linux) (i386-linux) compiled by GNU C version 2.95.2 20000313 (Debian GNU/Linux).
as -V -Qy -o view/boxrelations.o boxrelations.s
GNU assembler version 2.9.5 (i386-linux) using BFD version 2.9.5.0.31