Bug 55019 - Incorrectly use live argument register to save high register in thumb1 prologue
Summary: Incorrectly use live argument register to save high register in thumb1 prologue
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.7.3
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2012-10-22 09:43 UTC by Terry Guo
Modified: 2012-10-26 02:12 UTC (History)
1 user (show)

See Also:
Host:
Target: arm-eabi
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-10-22 00:00:00


Attachments
case to reproduce this bug (345 bytes, text/plain)
2012-10-22 11:23 UTC, Terry Guo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Terry Guo 2012-10-22 09:43:39 UTC
When run 4.7 regression test on cortex-m0 with options "-mthumb -mcpu=cortex-m0 -O1 -funroll-loops", case gcc.dg/torture/builtin-complex-1.c will fail due to the corruption of argument register as shown in below:

compare:
	push	{r3, r4, r6, lr}
	mov	r6, fp
	mov	r4, sl
	mov	r3, r9	<<-- r3 is clobbered
	push	{r3, r4, r6}
	mov	r6, r8
	push	{r6}
	mov	fp, r0
	mov	sl, r1
	mov	r9, r2
	mov	r8, r3  <<-- wrong value is used
Comment 1 Richard Earnshaw 2012-10-22 09:53:40 UTC
Testcase?
Comment 2 Terry Guo 2012-10-22 11:23:16 UTC
Created attachment 28505 [details]
case to reproduce this bug
Comment 3 xuepeng guo 2012-10-23 03:49:21 UTC
Author: xguo
Date: Tue Oct 23 03:49:17 2012
New Revision: 192703

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192703
Log:
	gcc/
	PR target/55019
	* config/arm/arm.c (thumb1_expand_prologue): Don't push high regs with
	live argument regs.

	gcc/testsuite/
	PR target/55019
	* gcc.dg/pr55019.c: New.

Added:
    trunk/gcc/testsuite/gcc.dg/pr55019.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/arm.c
    trunk/gcc/testsuite/ChangeLog
Comment 4 Terry Guo 2012-10-23 03:55:25 UTC
This issue is fixed.
Comment 5 Mikael Pettersson 2012-10-23 10:08:04 UTC
(In reply to comment #4)
> This issue is fixed.

The problem was reported for 4.7 branch, the fix was OK:d for 4.7 and trunk, but so far only applied to trunk.
Comment 6 Terry Guo 2012-10-23 10:13:08 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > This issue is fixed.
> 
> The problem was reported for 4.7 branch, the fix was OK:d for 4.7 and trunk,
> but so far only applied to trunk.

I plan to wait for some time to see if there is any unforeseen issue in trunk. And then will do back port.
Comment 7 Mikael Pettersson 2012-10-23 11:53:07 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > (In reply to comment #4)
> > > This issue is fixed.
> > 
> > The problem was reported for 4.7 branch, the fix was OK:d for 4.7 and trunk,
> > but so far only applied to trunk.
> 
> I plan to wait for some time to see if there is any unforeseen issue in trunk.
> And then will do back port.

Ok, thanks.  It wasn't obvious that you were going to do that since you had closed the bug as fixed.
Comment 8 xuepeng guo 2012-10-26 02:12:17 UTC
Author: xguo
Date: Fri Oct 26 02:12:06 2012
New Revision: 192831

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192831
Log:
	gcc/ChangeLog
	Backport from mainline
	2012-10-23  Terry Guo  <terry.guo@arm.com>

	PR target/55019
	* config/arm/arm.c (thumb1_expand_prologue): Don't push high regs with
	live argument regs.

	gcc/testsuite/ChangeLog
	Backport from mainline
	2012-10-23  Terry Guo  <terry.guo@arm.com>

	PR target/55019
	* gcc.dg/pr55019.c: New.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/pr55019.c
Modified:
    branches/gcc-4_7-branch/gcc/ChangeLog
    branches/gcc-4_7-branch/gcc/config/arm/arm.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog