* [Bug target/40668] 64-bit sparc miscompiles memcpy of argument inside switch
2009-07-07 5:56 [Bug target/40668] New: 64-bit sparc miscompiles memcpy of argument inside switch blp at cs dot stanford dot edu
@ 2009-07-07 5:58 ` blp at cs dot stanford dot edu
2009-07-07 5:58 ` blp at cs dot stanford dot edu
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: blp at cs dot stanford dot edu @ 2009-07-07 5:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from blp at cs dot stanford dot edu 2009-07-07 05:58 -------
Created an attachment (id=18148)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18148&action=view)
test program (before preprocessing)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40668
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/40668] 64-bit sparc miscompiles memcpy of argument inside switch
2009-07-07 5:56 [Bug target/40668] New: 64-bit sparc miscompiles memcpy of argument inside switch blp at cs dot stanford dot edu
2009-07-07 5:58 ` [Bug target/40668] " blp at cs dot stanford dot edu
@ 2009-07-07 5:58 ` blp at cs dot stanford dot edu
2009-07-07 11:36 ` mikpe at it dot uu dot se
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: blp at cs dot stanford dot edu @ 2009-07-07 5:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from blp at cs dot stanford dot edu 2009-07-07 05:57 -------
Created an attachment (id=18147)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18147&action=view)
preprocessed test input
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40668
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/40668] 64-bit sparc miscompiles memcpy of argument inside switch
2009-07-07 5:56 [Bug target/40668] New: 64-bit sparc miscompiles memcpy of argument inside switch blp at cs dot stanford dot edu
2009-07-07 5:58 ` [Bug target/40668] " blp at cs dot stanford dot edu
2009-07-07 5:58 ` blp at cs dot stanford dot edu
@ 2009-07-07 11:36 ` mikpe at it dot uu dot se
2009-07-07 16:28 ` mikpe at it dot uu dot se
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mikpe at it dot uu dot se @ 2009-07-07 11:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from mikpe at it dot uu dot se 2009-07-07 11:35 -------
Confirmed, with gcc-4.3-20090705 it works, with gcc-4.4-20090630 it fails.
Compiling with -S and comparing the .s files it looks like 4.4 completely
mis-schedules the code for put_uint32:
put_uint32:
.register %g2, #scratch
.register %g3, #scratch
ldub [%sp+2175], %g1
ldub [%sp+2176], %g3
ldub [%sp+2177], %g2
ldub [%sp+2178], %g4
st %o0, [%sp+2175]
stb %g4, [%o1+3]
stb %g1, [%o1]
stb %g3, [%o1+1]
jmp %o7+8
stb %g2, [%o1+2]
Notice how the store of %o0 to the four bytes at %sp+2175 comes after the
corresponding byte loads, so %g1 to %g4 are loaded with garbage, likely zeroes.
In contrast, gcc-4.3 generates the store before the loads:
put_uint32:
.register %g2, #scratch
.register %g3, #scratch
st %o0, [%sp+2175]
ldub [%sp+2176], %g3
ldub [%sp+2177], %g4
ldub [%sp+2178], %g2
ldub [%sp+2175], %g1
stb %g2, [%o1+3]
stb %g1, [%o1]
stb %g3, [%o1+1]
jmp %o7+8
stb %g4, [%o1+2]
--
mikpe at it dot uu dot se changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikpe at it dot uu dot se
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40668
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/40668] 64-bit sparc miscompiles memcpy of argument inside switch
2009-07-07 5:56 [Bug target/40668] New: 64-bit sparc miscompiles memcpy of argument inside switch blp at cs dot stanford dot edu
` (2 preceding siblings ...)
2009-07-07 11:36 ` mikpe at it dot uu dot se
@ 2009-07-07 16:28 ` mikpe at it dot uu dot se
2009-07-07 19:05 ` jakub at gcc dot gnu dot org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mikpe at it dot uu dot se @ 2009-07-07 16:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from mikpe at it dot uu dot se 2009-07-07 16:28 -------
A reghunt identified Jakub's (added to cc: list) r142481 (PR38367 fix) as the
source of this regression.
--
mikpe at it dot uu dot se changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40668
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/40668] 64-bit sparc miscompiles memcpy of argument inside switch
2009-07-07 5:56 [Bug target/40668] New: 64-bit sparc miscompiles memcpy of argument inside switch blp at cs dot stanford dot edu
` (3 preceding siblings ...)
2009-07-07 16:28 ` mikpe at it dot uu dot se
@ 2009-07-07 19:05 ` jakub at gcc dot gnu dot org
2009-07-07 23:10 ` mikpe at it dot uu dot se
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-07-07 19:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from jakub at gcc dot gnu dot org 2009-07-07 19:05 -------
Created an attachment (id=18151)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18151&action=view)
gcc44-pr40668.patch
Untested patch that fixes this testcase. I believe my commit was correct, but
apparently it can be modified later on without adjusting MEM_OFFSET.
I don't have a working SPARC box around ATM, so I can't bootstrap/regtest it
there.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40668
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/40668] 64-bit sparc miscompiles memcpy of argument inside switch
2009-07-07 5:56 [Bug target/40668] New: 64-bit sparc miscompiles memcpy of argument inside switch blp at cs dot stanford dot edu
` (4 preceding siblings ...)
2009-07-07 19:05 ` jakub at gcc dot gnu dot org
@ 2009-07-07 23:10 ` mikpe at it dot uu dot se
2009-07-08 16:43 ` mikpe at it dot uu dot se
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mikpe at it dot uu dot se @ 2009-07-07 23:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from mikpe at it dot uu dot se 2009-07-07 23:10 -------
(In reply to comment #5)
> Created an attachment (id=18151)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18151&action=view) [edit]
> gcc44-pr40668.patch
>
> Untested patch that fixes this testcase.
Thanks. This fixes the issue in a cross-compiler to sparc64-linux. I'm
currently bootstrapping 4.4-20090630 plus this patch on an Ultra5, I'll follow
up once that's complete (it will take quite a while).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40668
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/40668] 64-bit sparc miscompiles memcpy of argument inside switch
2009-07-07 5:56 [Bug target/40668] New: 64-bit sparc miscompiles memcpy of argument inside switch blp at cs dot stanford dot edu
` (5 preceding siblings ...)
2009-07-07 23:10 ` mikpe at it dot uu dot se
@ 2009-07-08 16:43 ` mikpe at it dot uu dot se
2009-07-08 17:30 ` blp at cs dot stanford dot edu
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mikpe at it dot uu dot se @ 2009-07-08 16:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from mikpe at it dot uu dot se 2009-07-08 16:43 -------
4.4-20090630 plus this fix bootstrapped fine, fixed the test case, built a
working 2.6.31-rc2 Linux kernel, and built a working Erlang VM.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40668
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/40668] 64-bit sparc miscompiles memcpy of argument inside switch
2009-07-07 5:56 [Bug target/40668] New: 64-bit sparc miscompiles memcpy of argument inside switch blp at cs dot stanford dot edu
` (6 preceding siblings ...)
2009-07-08 16:43 ` mikpe at it dot uu dot se
@ 2009-07-08 17:30 ` blp at cs dot stanford dot edu
2009-07-11 9:24 ` jakub at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: blp at cs dot stanford dot edu @ 2009-07-08 17:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from blp at cs dot stanford dot edu 2009-07-08 17:30 -------
Wow, that's amazingly fast turnaround. Thanks so much guys!
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40668
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/40668] 64-bit sparc miscompiles memcpy of argument inside switch
2009-07-07 5:56 [Bug target/40668] New: 64-bit sparc miscompiles memcpy of argument inside switch blp at cs dot stanford dot edu
` (7 preceding siblings ...)
2009-07-08 17:30 ` blp at cs dot stanford dot edu
@ 2009-07-11 9:24 ` jakub at gcc dot gnu dot org
2009-07-11 9:26 ` jakub at gcc dot gnu dot org
2010-09-20 21:46 ` ebotcazou at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-07-11 9:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from jakub at gcc dot gnu dot org 2009-07-11 09:23 -------
Subject: Bug 40668
Author: jakub
Date: Sat Jul 11 09:23:32 2009
New Revision: 149511
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149511
Log:
PR target/40668
* function.c (assign_parm_setup_stack): Adjust
MEM_OFFSET (data->stack_parm) if promoted_mode is different
from nominal_mode on big endian.
* gcc.c-torture/execute/pr40668.c: New test.
Added:
trunk/gcc/testsuite/gcc.c-torture/execute/pr40668.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/function.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40668
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/40668] 64-bit sparc miscompiles memcpy of argument inside switch
2009-07-07 5:56 [Bug target/40668] New: 64-bit sparc miscompiles memcpy of argument inside switch blp at cs dot stanford dot edu
` (8 preceding siblings ...)
2009-07-11 9:24 ` jakub at gcc dot gnu dot org
@ 2009-07-11 9:26 ` jakub at gcc dot gnu dot org
2010-09-20 21:46 ` ebotcazou at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-07-11 9:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from jakub at gcc dot gnu dot org 2009-07-11 09:26 -------
Subject: Bug 40668
Author: jakub
Date: Sat Jul 11 09:26:23 2009
New Revision: 149512
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149512
Log:
PR target/40668
* function.c (assign_parm_setup_stack): Adjust
MEM_OFFSET (data->stack_parm) if promoted_mode is different
from nominal_mode on big endian.
* gcc.c-torture/execute/pr40668.c: New test.
Added:
branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/pr40668.c
Modified:
branches/gcc-4_4-branch/gcc/ChangeLog
branches/gcc-4_4-branch/gcc/function.c
branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40668
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/40668] 64-bit sparc miscompiles memcpy of argument inside switch
2009-07-07 5:56 [Bug target/40668] New: 64-bit sparc miscompiles memcpy of argument inside switch blp at cs dot stanford dot edu
` (9 preceding siblings ...)
2009-07-11 9:26 ` jakub at gcc dot gnu dot org
@ 2010-09-20 21:46 ` ebotcazou at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2010-09-20 21:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from ebotcazou at gcc dot gnu dot org 2010-09-20 21:46 -------
By Jakub.
--
ebotcazou at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.4.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40668
^ permalink raw reply [flat|nested] 12+ messages in thread