Bug 58550 - [4.9 Regression] ][c++11] ICE with auto in function return type and lto
Summary: [4.9 Regression] ][c++11] ICE with auto in function return type and lto
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.9.0
: P1 normal
Target Milestone: 4.9.0
Assignee: Jason Merrill
URL:
Keywords: ice-on-invalid-code, lto
Depends on:
Blocks:
 
Reported: 2013-09-27 06:39 UTC by Volker Reichelt
Modified: 2014-01-24 19:06 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.8.1
Known to fail: 4.9.0
Last reconfirmed: 2013-09-27 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2013-09-27 06:39:51 UTC
The following (probably invalid) code snippet triggers an ICE on trunk (4.9.0 20130926) when compiled with "std=c++0x -flto":

====================
auto foo();

auto fp = foo;
====================

bug.cc:1:10: warning: 'foo' function uses 'auto' type specifier without trailing return type [enabled by default]
 auto foo();
          ^
bug.cc:3:14: internal compiler error: tree code 'template_type_parm' is not supported in LTO streams
 auto fp = foo;
              ^
0xa17696 DFS_write_tree
        ../../gcc/gcc/lto-streamer-out.c:1244
0xa165c9 DFS_write_tree_body
        ../../gcc/gcc/lto-streamer-out.c:461
0xa165c9 DFS_write_tree
        ../../gcc/gcc/lto-streamer-out.c:1152
0xa165c9 DFS_write_tree_body
        ../../gcc/gcc/lto-streamer-out.c:461
0xa165c9 DFS_write_tree
        ../../gcc/gcc/lto-streamer-out.c:1152
0xa18907 lto_output_tree(output_block*, tree_node*, bool, bool)
        ../../gcc/gcc/lto-streamer-out.c:1334
0xa12cfc write_global_stream
        ../../gcc/gcc/lto-streamer-out.c:2084
0xa1a990 lto_output_decl_state_streams
        ../../gcc/gcc/lto-streamer-out.c:2128
0xa1a990 produce_asm_for_decls
        ../../gcc/gcc/lto-streamer-out.c:2413
0xa4e720 ipa_write_summaries_2
        ../../gcc/gcc/passes.c:2283
0xa4f799 ipa_write_summaries_1
        ../../gcc/gcc/passes.c:2314
0xa4f799 ipa_write_summaries()
        ../../gcc/gcc/passes.c:2371
0x807c5b ipa_passes
        ../../gcc/gcc/cgraphunit.c:2019
0x807c5b compile()
        ../../gcc/gcc/cgraphunit.c:2115
0x807ee9 finalize_compilation_unit()
        ../../gcc/gcc/cgraphunit.c:2269
0x61b2b0 cp_write_global_declarations()
        ../../gcc/gcc/cp/decl2.c:4360
Please submit a full bug report, [etc.]


In GCC 4.8.1 the code was rejected:
bug.cc:1:10: warning: 'foo' function uses 'auto' type specifier without trailing return type [enabled by default]
 auto foo();
          ^
bug.cc:3:11: error: use of 'auto foo()' before deduction of 'auto'
 auto fp = foo;
Comment 1 Marek Polacek 2013-09-27 07:09:45 UTC
Confirmed with trunk.  Interesting is that with -std=gnu++1y:
w.C:3:11: error: use of ‘auto foo()’ before deduction of ‘auto’
 auto fp = foo;
           ^
Comment 2 Marek Polacek 2013-09-27 08:24:03 UTC
This one seems to start with r198099 -- but it might be some other latent issue...
Comment 3 Richard Biener 2013-11-05 14:35:11 UTC
language specific trees should not leak to LTO.  If this is invalid input then
raise an error - we won't even start streaming into LTO bytecode then.
Comment 4 Jason Merrill 2014-01-24 19:05:57 UTC
Fixed.
Comment 5 Jason Merrill 2014-01-24 19:06:11 UTC
Author: jason
Date: Fri Jan 24 19:05:39 2014
New Revision: 207055

URL: http://gcc.gnu.org/viewcvs?rev=207055&root=gcc&view=rev
Log:
	PR c++/58550
	* decl.c (grokdeclarator): Turn pedwarn about auto return type in
	c++11 into error.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/auto41.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c