public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/49207] New: Instruction scheduling error in GCC mips cross-compiler
@ 2011-05-28 6:19 hanib at ece dot ubc.ca
2011-05-28 6:20 ` [Bug c/49207] " hanib at ece dot ubc.ca
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: hanib at ece dot ubc.ca @ 2011-05-28 6:19 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49207
Summary: Instruction scheduling error in GCC mips
cross-compiler
Product: gcc
Version: 4.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: hanib@ece.ubc.ca
When compiling a testbench program using -O2 optimization, the GCC MIPS
cross-compiler generates an incorrect instruction sequence (a store before a
load to the same memory location) which leads to a memory corruption problem
and crashes the program. If the -O1 or -O0 switches are used, this problem does
not occur.
The output of the gcc -v -save-temps command is included below and the test.i
file is attached. I am also including, below, the portion of assembly code that
contains the erroneous instruction sequence (see arrows).
/mnt/disk/home/tools/mipsel/bin/mipsel-linux-gcc -v -save-temps -O2 -static
-DSPEC_CPU_LINUX_IA32 test.o -lm -o perlbench
Using built-in specs.
Target: mipsel-linux
Configured with: ../../src/gcc-4.4.3/configure --target=mipsel-linux
--prefix=/mnt/disk/home/tools/mipsel --with-sysroot=/mnt/disk/home/tools/mipsel
--disable-libssp --disable-libgomp --disable-libmudflap --disable-nls
--enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.4.3 (GCC)
COMPILER_PATH=/mnt/disk/home/tools/mipsel/libexec/gcc/mipsel-linux/4.4.3/:/mnt/disk/home/tools/mipsel/libexec/gcc/mipsel-linux/4.4.3/:/mnt/disk/home/tools/mipsel/libexec/gcc/mipsel-linux/:/mnt/disk/home/tools/mipsel/lib/gcc/mipsel-linux/4.4.3/:/mnt/disk/home/tools/mipsel/lib/gcc/mipsel-linux/:/mnt/disk/home/tools/mipsel/lib/gcc/mipsel-linux/4.4.3/../../../../mipsel-linux/bin/
LIBRARY_PATH=/mnt/disk/home/tools/mipsel/lib/gcc/mipsel-linux/4.4.3/:/mnt/disk/home/tools/mipsel/lib/gcc/mipsel-linux/4.4.3/../../../../mipsel-linux/lib/:/mnt/disk/home/tools/mipsel/lib/:/mnt/disk/home/tools/mipsel/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O2' '-static' '-DSPEC_CPU_LINUX_IA32'
'-o' 'perlbench' '-mllsc' '-mno-shared'
/mnt/disk/home/tools/mipsel/libexec/gcc/mipsel-linux/4.4.3/collect2
--sysroot=/mnt/disk/home/tools/mipsel -EL -static -o perlbench
/mnt/disk/home/tools/mipsel/usr/lib/crt1.o
/mnt/disk/home/tools/mipsel/usr/lib/crti.o
/mnt/disk/home/tools/mipsel/lib/gcc/mipsel-linux/4.4.3/crtbeginT.o
-L/mnt/disk/home/tools/mipsel/lib/gcc/mipsel-linux/4.4.3
-L/mnt/disk/home/tools/mipsel/lib/gcc/mipsel-linux/4.4.3/../../../../mipsel-linux/lib
-L/mnt/disk/home/tools/mipsel/lib -L/mnt/disk/home/tools/mipsel/usr/lib test.o
-lm --start-group -lgcc -lgcc_eh -lc --end-group
/mnt/disk/home/tools/mipsel/lib/gcc/mipsel-linux/4.4.3/crtend.o
/mnt/disk/home/tools/mipsel/usr/lib/crtn.o
/mnt/disk/home/tools/mipsel/usr/lib/crt1.o: In function `__start':
>>>>>>>>>>>>>>>>>>>>>>> assembly code >>>>>>>>>>>>>>>>>>>>
$L100:
lw $3,%got(PL_xiv_root)($28)
lw $2,0($16)
lw $5,0($3)
addiu $4,$2,12
>>>> sw $5,12($2)
>>>> lw $19,12($2)
li $2,2 # 0x2
beq $17,$2,$L184
sw $4,0($3)
beq $18,$0,$L111
nop
move $20,$0
move $21,$0
move $18,$0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/49207] Instruction scheduling error in GCC mips cross-compiler
2011-05-28 6:19 [Bug c/49207] New: Instruction scheduling error in GCC mips cross-compiler hanib at ece dot ubc.ca
@ 2011-05-28 6:20 ` hanib at ece dot ubc.ca
2011-05-28 7:38 ` hanib at ece dot ubc.ca
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: hanib at ece dot ubc.ca @ 2011-05-28 6:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49207
--- Comment #1 from hanib at ece dot ubc.ca 2011-05-28 06:19:34 UTC ---
Created attachment 24384
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24384
preprocessed file
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/49207] Instruction scheduling error in GCC mips cross-compiler
2011-05-28 6:19 [Bug c/49207] New: Instruction scheduling error in GCC mips cross-compiler hanib at ece dot ubc.ca
2011-05-28 6:20 ` [Bug c/49207] " hanib at ece dot ubc.ca
@ 2011-05-28 7:38 ` hanib at ece dot ubc.ca
2011-05-28 9:48 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: hanib at ece dot ubc.ca @ 2011-05-28 7:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49207
--- Comment #2 from hanib at ece dot ubc.ca 2011-05-28 06:20:36 UTC ---
Created attachment 24385
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24385
assembly language file
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/49207] Instruction scheduling error in GCC mips cross-compiler
2011-05-28 6:19 [Bug c/49207] New: Instruction scheduling error in GCC mips cross-compiler hanib at ece dot ubc.ca
2011-05-28 6:20 ` [Bug c/49207] " hanib at ece dot ubc.ca
2011-05-28 7:38 ` hanib at ece dot ubc.ca
@ 2011-05-28 9:48 ` pinskia at gcc dot gnu.org
2011-05-28 21:39 ` hanib at ece dot ubc.ca
2013-11-10 5:34 ` [Bug middle-end/49207] " pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-05-28 9:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49207
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-05-28 09:32:38 UTC ---
I think you have an aliasing problem in your code.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/49207] Instruction scheduling error in GCC mips cross-compiler
2011-05-28 6:19 [Bug c/49207] New: Instruction scheduling error in GCC mips cross-compiler hanib at ece dot ubc.ca
` (2 preceding siblings ...)
2011-05-28 9:48 ` pinskia at gcc dot gnu.org
@ 2011-05-28 21:39 ` hanib at ece dot ubc.ca
2013-11-10 5:34 ` [Bug middle-end/49207] " pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: hanib at ece dot ubc.ca @ 2011-05-28 21:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49207
--- Comment #4 from hanib at ece dot ubc.ca 2011-05-28 21:21:40 UTC ---
(In reply to comment #3)
> I think you have an aliasing problem in your code.
The code I am compiling is the Perlbench benchmark from SPEC-CPU2006. If I
compile the code for an Intel machine using -O2 there is no problem. This
problem only appears when I use the GCC MIPS cross-compiler with the -O2
switch. I also traced through the code and the sequence of these two
instructions should be reversed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug middle-end/49207] Instruction scheduling error in GCC mips cross-compiler
2011-05-28 6:19 [Bug c/49207] New: Instruction scheduling error in GCC mips cross-compiler hanib at ece dot ubc.ca
` (3 preceding siblings ...)
2011-05-28 21:39 ` hanib at ece dot ubc.ca
@ 2013-11-10 5:34 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-11-10 5:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49207
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Component|c |middle-end
Resolution|--- |INVALID
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to hanib from comment #4)
> (In reply to comment #3)
> > I think you have an aliasing problem in your code.
>
> The code I am compiling is the Perlbench benchmark from SPEC-CPU2006. If I
> compile the code for an Intel machine using -O2 there is no problem. This
> problem only appears when I use the GCC MIPS cross-compiler with the -O2
> switch. I also traced through the code and the sequence of these two
> instructions should be reversed.
Perl in SPEC CPU 2006 has known aliasing bugs in it; just use
-fno-strict-aliasing.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-11-10 5:34 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-28 6:19 [Bug c/49207] New: Instruction scheduling error in GCC mips cross-compiler hanib at ece dot ubc.ca
2011-05-28 6:20 ` [Bug c/49207] " hanib at ece dot ubc.ca
2011-05-28 7:38 ` hanib at ece dot ubc.ca
2011-05-28 9:48 ` pinskia at gcc dot gnu.org
2011-05-28 21:39 ` hanib at ece dot ubc.ca
2013-11-10 5:34 ` [Bug middle-end/49207] " pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).