This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/77304] New: ICE on C++ code with invalid template parameter: in gimplify_expr, at gimplify.c:11260
- From: "su at cs dot ucdavis.edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 19 Aug 2016 23:24:41 +0000
- Subject: [Bug c++/77304] New: ICE on C++ code with invalid template parameter: in gimplify_expr, at gimplify.c:11260
- Authentication-results: sourceware.org; auth=none
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77304
Bug ID: 77304
Summary: ICE on C++ code with invalid template parameter: in
gimplify_expr, at gimplify.c:11260
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: su at cs dot ucdavis.edu
Target Milestone: ---
It seems to affect all earlier versions of GCC since 4.7.x (hangs on 4.7.x). It
is properly rejected by 4.6.x.
$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160819 (experimental) [trunk revision 239608] (GCC)
$
$ g++-trunk -c small.cpp
small.cpp:5:14: error: ‘struct S’ is not a valid type for a template non-type
parameter
template < S > void f () {}
^
small.cpp: In static member function ‘static void* A<T>::g() [with T = int]’:
small.cpp:9:21: internal compiler error: in gimplify_expr, at gimplify.c:11260
return (void *) f < a >;
^~~~~~~
0xb5a8cb gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc-source-trunk/gcc/gimplify.c:11260
0xb646cc gimplify_addr_expr
../../gcc-source-trunk/gcc/gimplify.c:5211
0xb5a030 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc-source-trunk/gcc/gimplify.c:10558
0xb6c08b gimplify_modify_expr
../../gcc-source-trunk/gcc/gimplify.c:4808
0xb58bf8 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc-source-trunk/gcc/gimplify.c:10512
0xb5cb86 gimplify_stmt(tree_node**, gimple**)
../../gcc-source-trunk/gcc/gimplify.c:5804
0xb6a3c5 gimplify_and_add
../../gcc-source-trunk/gcc/gimplify.c:427
0xb6a3c5 gimplify_return_expr
../../gcc-source-trunk/gcc/gimplify.c:1371
0xb5946b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc-source-trunk/gcc/gimplify.c:10761
0xb5cb86 gimplify_stmt(tree_node**, gimple**)
../../gcc-source-trunk/gcc/gimplify.c:5804
0xb5e8ab gimplify_body(tree_node*, bool)
../../gcc-source-trunk/gcc/gimplify.c:11695
0xb5ef06 gimplify_function_tree(tree_node*)
../../gcc-source-trunk/gcc/gimplify.c:11851
0x9d6fa7 cgraph_node::analyze()
../../gcc-source-trunk/gcc/cgraphunit.c:625
0x9d9b50 analyze_functions
../../gcc-source-trunk/gcc/cgraphunit.c:1086
0x9dadb8 symbol_table::finalize_compilation_unit()
../../gcc-source-trunk/gcc/cgraphunit.c:2546
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$
---------------------------------------
struct S {};
template < typename T > struct A
{
template < S > void f () {}
static void * g ()
{
return (void *) f < a >;
}
static S a;
};
void * f ()
{
return A < int >::g ();
}