From: Senthil Kumar Selvaraj Date: Tue, 20 May 2014 08:37:50 +0000 (+0000) Subject: backport: re PR target/60991 ([avr] Stack corruption when using 24-bit integers __int... X-Git-Tag: releases/gcc-4.7.4~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd941454c76ab86214d0ed5d07d61ff8057bd40c;p=thirdparty%2Fgcc.git backport: re PR target/60991 ([avr] Stack corruption when using 24-bit integers __int24 or __memx pointers in large stack frame) gcc/ 2014-05-20 Senthil Kumar Selvaraj Backport from mainline r210325 2014-05-12 Senthil Kumar Selvaraj PR target/60991 * config/avr/avr.c (avr_out_store_psi): Use correct constant to restore Y. gcc/testsuite/ 2014-05-20 Senthil Kumar Selvaraj Backport from mainline r210325 2014-05-12 Senthil Kumar Selvaraj PR target/60991 * gcc.target/avr/pr60991.c: New testcase. From-SVN: r210635 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8cc35b37df59..92b1ffad583a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2014-05-20 Senthil Kumar Selvaraj + + Backport from mainline r210325 + 2014-05-12 Senthil Kumar Selvaraj + + PR target/60991 + * config/avr/avr.c (avr_out_store_psi): Use correct constant + to restore Y. + 2014-05-13 Richard Biener Backport from mainline diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 0cb689ac8f24..100be1bf2a25 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -3643,7 +3643,7 @@ avr_out_store_psi (rtx insn, rtx *op, int *plen) "std Y+61,%A1" CR_TAB "std Y+62,%B1" CR_TAB "std Y+63,%C1" CR_TAB - "sbiw r28,%o0-60", op, plen, -5); + "sbiw r28,%o0-61", op, plen, -5); return avr_asm_len ("subi r28,lo8(-%o0)" CR_TAB "sbci r29,hi8(-%o0)" CR_TAB diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bf2dd75dc2e8..4609c56f7f1c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2014-05-20 Senthil Kumar Selvaraj + + Backport from mainline r210325 + 2014-05-12 Senthil Kumar Selvaraj + + PR target/60991 + * gcc.target/avr/pr60991.c: New testcase. + 2014-05-13 Richard Biener Backport from mainline diff --git a/gcc/testsuite/gcc.target/avr/pr60991.c b/gcc/testsuite/gcc.target/avr/pr60991.c new file mode 100644 index 000000000000..a09f42a62b3f --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/pr60991.c @@ -0,0 +1,21 @@ +/* { dg-do run } */ +/* { dg-options "-O1" } */ + +/* This testcase (simplified from the original bug report) exposes + PR60991. The code generated for writing the __int24 value corrupts + the frame pointer if the offset is <= 63 + MAX_LD_OFFSET */ + +#include + +int main(void) +{ + volatile char junk[62]; + junk[0] = 5; + volatile __int24 staticConfig = 0; + + if (junk[0] != 5) + abort(); + + exit(0); + return 0; +}