[PATCH,TARGET]PR21078,21080 Fix AVR builtin_return_address

Andrew Hutchinson andrewhutchinson@cox.net
Tue Nov 10 05:37:00 GMT 2009


Hi Anatoly,

The attached patch corrects for builtin_return_address bug. This will 
now give correct return address for current function (count = 0).
It will output warning message for AVR_3_BYTE_PC - where Pmode value 
cannot support 3 byte PC.

    foo.c:159:35: warning: 'builtin_return_address' contains only 2 
bytes of address

Other levels (count >0) are not supported and gcc will now (correctly) 
issue warning:

    foo.c:159:35: warning: unsupported argument to 
'__builtin_return_address'

The assembler file also includes calculated stack size.

/* prologue: function */
/* frame size = 0 */
/* stack size = 1 */


Ok for 4.5?

Could you also approve to backport to 4.4 and 4.3





2009-11-09  Andy Hutchinson   <hutchinsonandy@gcc.gnu.org>

   PR target/21078, 21080
   * avr.c (avr_return_addr_rtx): New function for builtin_return_address.
    (expand_prologue): Calculate stack usage.
    (avr_asm_function_end_prologue): Output stack size and offset label.
    (stack_usage): New static variable for stack size.
   * avr.h (RETURN_ADDR_RTX): Replace.
    *avr-protos.h (avr_return_addr_rtx): New function.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: newreturnaddr.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20091110/91eb8554/attachment.ksh>


More information about the Gcc-patches mailing list