GCC Bugzilla has been upgraded from version 4.4.9 to 5.0rc3. If you see any problem, please report it to bug 64968.
Bug 21080 - Excecution test failure for avr for pr17377 test case.
Summary: Excecution test failure for avr for pr17377 test case.
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: 4.5.0
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
: 21078 (view as bug list)
Depends on: 21078
Blocks:
  Show dependency treegraph
 
Reported: 2005-04-17 22:43 UTC by Björn Haase
Modified: 2010-01-29 17:08 UTC (History)
4 users (show)

See Also:
Host:
Target: avr-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-04-04 21:43:08


Attachments
Patch to correct return_address (1.35 KB, patch)
2008-03-29 12:55 UTC, Andy Hutchinson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Björn Haase 2005-04-17 22:43:26 UTC
Excecution of  gcc.c-torture/excecute/pr17377.c fails for optimization level 
-O0 and passes for other optimizer switches: Somewhat suspicious.
Comment 1 Andrew Pinski 2005-04-17 22:47:02 UTC
This looks like the same cause as PR 21078 since both use __builtin_return_address.
Comment 2 Eric Weddington 2007-07-25 17:57:27 UTC
The AVR test results for a 4.2.1 prerelease still shows failure on -O0 only:
http://gcc.gnu.org/ml/gcc-testresults/2007-07/msg00335.html

However the results for a 4.3 snapshot shows failure on all -O settings:
http://gcc.gnu.org/ml/gcc-testresults/2007-07/msg00603.html
Comment 3 Andy Hutchinson 2008-03-29 12:55:55 UTC
Created attachment 15396 [details]
Patch to correct return_address

The attached patch fixes this problem and PR21078
The AVR target support for builtin_return_address only returned value of frame_pointer+1 - so it would only be correct if stack and frame were empty.

The attached patch calculates the stack usage in the function prolog. This is placed in symbol stack_usage using UNSPEC instruction pattern. Builtin Return address uses RETURN_ADDR_RTX(count, tem) to add this to frame pointer to get to correct address. This only supports level 0 (same function). Other levels (ie upper functions) return 0  - which is correct response if not supported.
The address is that read from the stack - ie word address.

Testsuite torture/execute/20010122-1.c and PR17377.c both pass with this patch applied.
Comment 4 Andy Hutchinson 2009-10-31 15:27:56 UTC
*** Bug 21078 has been marked as a duplicate of this bug. ***
Comment 5 Andy Hutchinson 2009-10-31 17:02:39 UTC
Anatoly,

can we implement this patch to correct __builtin_return_address and thus remove these old bug reports and associated testsuite failures? It also provides a means to document stack usage which would seem useful.
Comment 6 Andy Hutchinson 2009-11-26 17:20:25 UTC
Fixed on 4.5

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21078
Comment 7 Eric Weddington 2010-01-29 17:08:40 UTC
Setting Target Milestone.