Bug 34134 - [4.1/4.2/4.3 Regression] ICE when using __builtin_stack_restore
Summary: [4.1/4.2/4.3 Regression] ICE when using __builtin_stack_restore
Status: RESOLVED DUPLICATE of bug 31128
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.2.3
: P3 normal
Target Milestone: ---
Assignee: Jakub Jelinek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-17 14:01 UTC by Török Edwin
Modified: 2007-11-17 18:21 UTC (History)
3 users (show)

See Also:
Host: x86_64-linux-gnu
Target: x86_64-linux-gnu
Build: x86_64-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2007-11-17 17:33:09


Attachments
reduced testcase (300 bytes, text/plain)
2007-11-17 14:03 UTC, Török Edwin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Török Edwin 2007-11-17 14:01:37 UTC
Using gcc 4.1, 4.2, or 4.3 I get an ICE when compiling testcase-min.i

$ gcc-4.2 testcase-min.i -O1 -c
testcase-min.i: In function ‘main’:
testcase-min.i:4: warning: return type of ‘main’ is not ‘int’
testcase-min.i:21: internal compiler error: in lhd_set_decl_assembler_name, at langhooks.c:165
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.2/README.Bugs>.

$ gcc-4.2 -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.2.3 20071014 (prerelease) (Debian 4.2.2-3)

$ gcc-4.1 testcase-min.i -O1 -c
testcase-min.i: In function ‘main’:
testcase-min.i:4: warning: return type of ‘main’ is not ‘int’
testcase-min.i:21: internal compiler error: in lhd_set_decl_assembler_name, at langhooks.c:165
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.1/README.Bugs>.
Preprocessed source stored into /tmp/ccWsoTnK.out file, please attach this to your bugreport

$ gcc-4.1 -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.1.3 --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release x86_64-linux-gnu
Thread model: posix
gcc version 4.1.3 20070831 (prerelease) (Debian 4.1.2-16)

$ /usr/lib/gcc-snapshot/bin/gcc testcase-min.i -O1 -c
testcase-min.i: In function 'main':
testcase-min.i:4: warning: return type of 'main' is not 'int'
testcase-min.i:21: internal compiler error: tree check: expected tree that contains 'decl with RTL' structure, have 'nop_expr' in expand_stack_restore, at stmt.c:1998
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-snapshot/README.Bugs> for instructions.

$ /usr/lib/gcc-snapshot/bin/gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 20071116-1' --with-bugurl=file:///usr/share/doc/gcc-snapshot/README.Bugs --enable-languages=c,c++,java,fortran,objc,obj-c++,ada,treelang --prefix=/usr/lib/gcc-snapshot --enable-shared --with-system-zlib --disable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-awt=gtk --enable-gtk-cairo --disable-plugin --with-java-home=/usr/lib/gcc-snapshot/jre --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-mpfr --disable-werror --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.3.0 20071116 (experimental) [trunk revision 127646] (Debian 20071116-1)

$ uname -a
Linux lightspeed2 2.6.23-rc8-hrt1-cfs-v22-g1bef7dc0-dirty #17 Sun Sep 30 18:49:34 EEST 2007 x86_64 GNU/Linux
Comment 1 Török Edwin 2007-11-17 14:03:27 UTC
Created attachment 14572 [details]
reduced testcase

To reproduce bug run: "gcc -O1 testcase-min.i"
I used the delta tool to produce a reduced testcase.

The original code is C code generated by LLVM's C backend.
Comment 2 Török Edwin 2007-11-17 14:09:12 UTC
(In reply to comment #1)
> Created an attachment (id=14572) [edit]
> reduced testcase
> 
> To reproduce bug run: "gcc -O1 testcase-min.i"
> I used the delta tool to produce a reduced testcase.
> 
> The original code is C code generated by LLVM's C backend.
> 

gcc-3.4 is able to compile the attached testcase without an ICE:
$ gcc-3.4 -c /tmp/testcase-min.i -O1
testcase-min.i: In function `main':
testcase-min.i:18: warning: assignment makes pointer from integer without a cast
testcase-min.i:4: warning: return type of 'main' is not `int'

$ gcc-3.4 -v
Reading specs from /usr/lib/gcc/x86_64-linux-gnu/3.4.6/specs
Configured with: ../src/configure -v --enable-languages=c,c++,f77,pascal --prefix=/usr --libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --program-suffix=-3.4 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug x86_64-linux-gnu
Thread model: posix
gcc version 3.4.6 (Debian 3.4.6-6)
Comment 3 Jakub Jelinek 2007-11-17 17:33:09 UTC
LLVM got the pointer type wrong.  Anyway, we shouldn't ICE on this.
Testing a fix.
Comment 4 Andrew Pinski 2007-11-17 18:20:38 UTC
(In reply to comment #3)
> LLVM got the pointer type wrong.  Anyway, we shouldn't ICE on this.
> Testing a fix.

really these functions should not be exposed.
Comment 5 Andrew Pinski 2007-11-17 18:21:17 UTC

*** This bug has been marked as a duplicate of 31128 ***
Comment 6 Jakub Jelinek 2007-12-04 21:55:54 UTC
Subject: Bug 34134

Author: jakub
Date: Tue Dec  4 21:55:32 2007
New Revision: 130609

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130609
Log:
	PR middle-end/34134
	* stmt.c (expand_stack_restore): Call expand_normal on var to get
	rtx for it instead of assuming it will be a VAR_DECL.

	* gcc.c-torture/compile/20071117-1.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/20071117-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/stmt.c
    trunk/gcc/testsuite/ChangeLog