The fix for PR target/56807 has introduced ICEs on big nested frames: eric@polaris:~/gnat/bugs/N213-061> cat t.c void foo (int i) { void nested (void) { char arr[1U << 31]; arr[i] = 0; } nested (); } eric@polaris:~/gnat/bugs/N213-061> ~/gnat/gnat7_47/x86_64-pc-mingw32/gcc/cc1 -quiet t.c t.c: In function 'nested': t.c:7:3: internal compiler error: in change_address_1, at emit-rtl.c:2001 Please submit a full bug report, with preprocessed source if appropriate. Contact <http://gcc.gnu.org/bugs.html> for instructions.
Hmm, I can't reproduce this with recent 4.9 gcc. There is no ICE.
I built recent 4.8 cross-compiler and tested. Again no ICE for this testcase
Sorry, minor pilot error, try with: void foo (int i) { void nested (void) { char arr[(1U << 31) + 4]; arr[i] = 0; } nested (); }
Confirmed. It seems to be related to array-size?!? During debugging I found that r10 seems to live, and rax doesn't. I will look into it.
Ok found issue. Problem is that x86_64 instructions have a maximum-offset of 2^31. Legitimate instruction doesn't detect here that constant is unsigned, so it fails. Nevertheless issue would happen always too for (1U << 32) even for x86_64 abi. Solution might be here to use the eax-register for addressing instead of constant.
Patch posted to ML at http://gcc.gnu.org/ml/gcc-patches/2014-02/msg00900.html
Author: ktietz Date: Tue Feb 18 12:49:15 2014 New Revision: 207844 URL: http://gcc.gnu.org/viewcvs?rev=207844&root=gcc&view=rev Log: 2014-02-18 Kai Tietz <ktietz@redhat.com> PR target/60193 * config/i386/i386.c (ix86_expand_prologue): Use rax register as displacement for restoring %r10, %rax. Additional fix wrong offset for restoring both-registers. 2014-02-18 Kai Tietz <ktietz@redhat.com> PR target/60193 * gcc.target/i386/nest-1.c: New testcase. Added: trunk/gcc/testsuite/gcc.target/i386/nest-1.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386.c trunk/gcc/testsuite/ChangeLog
Fixed on the trunk then.
Author: ktietz Date: Tue Feb 18 12:57:32 2014 New Revision: 207845 URL: http://gcc.gnu.org/viewcvs?rev=207845&root=gcc&view=rev Log: 2014-02-18 Kai Tietz <ktietz@redhat.com> Backport from mainline PR target/60193 * config/i386/i386.c (ix86_expand_prologue): Use rax register as displacement for restoring %r10, %rax. Additional fix wrong offset for restoring both-registers. 2014-02-18 Kai Tietz <ktietz@redhat.com> PR target/60193 * gcc.target/i386/nest-1.c: New testcase. Added: branches/gcc-4_8-branch/gcc/testsuite/gcc.target/i386/nest-1.c Modified: branches/gcc-4_8-branch/gcc/ChangeLog branches/gcc-4_8-branch/gcc/config/i386/i386.c branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
Author: ktietz Date: Tue Feb 18 13:46:38 2014 New Revision: 207846 URL: http://gcc.gnu.org/viewcvs?rev=207846&root=gcc&view=rev Log: 2014-02-18 Kai Tietz <ktietz@redhat.com> Backport from mainline PR target/60193 * config/i386/i386.c (ix86_expand_prologue): Use rax register as displacement for restoring %r10, %rax. Additional fix wrong offset for restoring both-registers. 2014-02-18 Kai Tietz <ktietz@redhat.com> PR target/60193 * gcc.target/i386/nest-1.c: New testcase. Added: branches/gcc-4_7-branch/gcc/testsuite/gcc.target/i386/nest-1.c Modified: branches/gcc-4_7-branch/gcc/ChangeLog branches/gcc-4_7-branch/gcc/config/i386/i386.c branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
Fixed on all open branches. Close bug