Bug 26775 - a stack pointer is not recovered correctly when using alloca.
Summary: a stack pointer is not recovered correctly when using alloca.
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.6
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-21 07:45 UTC by inaoka.kazuhiro
Modified: 2006-04-30 04:12 UTC (History)
1 user (show)

See Also:
Host:
Target: m32r
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-03-22 23:04:41


Attachments
testcase (198 bytes, text/plain)
2006-03-21 07:51 UTC, inaoka.kazuhiro
Details
ng output (393 bytes, text/plain)
2006-03-21 07:52 UTC, inaoka.kazuhiro
Details

Note You need to log in before you can comment on or make changes to this bug.
Description inaoka.kazuhiro 2006-03-21 07:45:26 UTC
When an alloca() is used with large auto variable area, a stack pointer is not recovered correctly.
Comment 1 inaoka.kazuhiro 2006-03-21 07:51:35 UTC
Created attachment 11078 [details]
testcase

m32r-linux-gnu-gcc -S alloca.c

Asm output has the following code.

        ; EPILOGUE
        ld24 r4,#32768
        add sp,r4       <== NG (a stack pointer must be recovered with fp.)
        pop fp
        jmp lr
Comment 2 inaoka.kazuhiro 2006-03-21 07:52:36 UTC
Created attachment 11079 [details]
ng output

NG case.
Comment 3 Richard Biener 2006-03-21 09:28:52 UTC
The 3.4 branch is closed, can you check 4.0.3 or 4.1.0 please?
Comment 4 inaoka.kazuhiro 2006-03-22 09:49:12 UTC
4.0.3 and 4.1.0 have a same problem.
Comment 5 Andrew Pinski 2006-03-22 23:04:41 UTC
Changing back to new then.
Comment 6 Nick Clifton 2006-04-04 09:18:41 UTC
Subject: Bug 26775

Author: nickc
Date: Tue Apr  4 09:18:38 2006
New Revision: 112659

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=112659
Log:
PR target/26775
PR target/26776
* config/m32r/m32r.c (m32r_output_function_epilogue): Case for a large 
  stack frame at epilogue. Use fp to recover a stack pointer for alloca 
  function at epilogue.                  

Modified:
    branches/gcc-4_0-branch/gcc/ChangeLog
    branches/gcc-4_0-branch/gcc/config/m32r/initfini.c
    branches/gcc-4_0-branch/gcc/config/m32r/m32r.c

Comment 7 Nick Clifton 2006-04-04 09:20:38 UTC
Subject: Bug 26775

Author: nickc
Date: Tue Apr  4 09:20:35 2006
New Revision: 112660

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=112660
Log:
PR target/26775
PR target/26776
* config/m32r/m32r.c (m32r_output_function_epilogue): Case for a large stack 
  frame at epilogue. Use fp to recover a stack pointer for alloca function 
  at epilogue.                  

Modified:
    branches/gcc-3_4-branch/gcc/ChangeLog
    branches/gcc-3_4-branch/gcc/config/m32r/m32r.c

Comment 8 Andrew Pinski 2006-04-30 04:12:22 UTC
Fixed.