https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69797
Bug ID: 69797 Summary: ICE on invalid code on x86_64-linux-gnu in operator[], at vec.h:714 Product: gcc Version: 6.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: --- The following code causes an ICE when compiled with the current gcc trunk on x86_64-linux-gnu. This also affects 4.8.x and later releases, and is a regression from 4.7.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/6.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk --enable-languages=c,c++ --disable-werror --enable-multilib Thread model: posix gcc version 6.0.0 20160212 (experimental) [trunk revision 233377] (GCC) $ $ $ $ g++-4.7 -c small.cc small.cc: In function ‘void fn1()’: small.cc:4:23: error: too few arguments to function ‘__atomic_fetch_add’ $ $ $ $ g++-trunk -c small.cc small.cc: In function ‘void fn1()’: small.cc:4:23: internal compiler error: in operator[], at vec.h:714 __atomic_fetch_add (); ^ 0x8643c2 vec<tree_node*, va_gc, vl_embed>::operator[](unsigned int) ../../gcc-trunk/gcc/vec.h:714 0x8643c2 resolve_overloaded_atomic_exchange ../../gcc-trunk/gcc/c-family/c-common.c:11030 0x8643c2 resolve_overloaded_builtin(unsigned int, tree_node*, vec<tree_node*, va_gc, vl_embed>*) ../../gcc-trunk/gcc/c-family/c-common.c:11305 0x781c2a finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) ../../gcc-trunk/gcc/cp/semantics.c:2381 0x6fe182 cp_parser_postfix_expression ../../gcc-trunk/gcc/cp/parser.c:6902 0x6fc28c cp_parser_unary_expression ../../gcc-trunk/gcc/cp/parser.c:7989 0x706557 cp_parser_cast_expression ../../gcc-trunk/gcc/cp/parser.c:8666 0x706aed cp_parser_binary_expression ../../gcc-trunk/gcc/cp/parser.c:8767 0x707390 cp_parser_assignment_expression ../../gcc-trunk/gcc/cp/parser.c:9054 0x709d6a cp_parser_expression ../../gcc-trunk/gcc/cp/parser.c:9223 0x70a313 cp_parser_expression_statement ../../gcc-trunk/gcc/cp/parser.c:10684 0x71958e cp_parser_statement ../../gcc-trunk/gcc/cp/parser.c:10535 0x719f94 cp_parser_statement_seq_opt ../../gcc-trunk/gcc/cp/parser.c:10807 0x71a09f cp_parser_compound_statement ../../gcc-trunk/gcc/cp/parser.c:10761 0x71a1fd cp_parser_function_body ../../gcc-trunk/gcc/cp/parser.c:20641 0x71a1fd cp_parser_ctor_initializer_opt_and_function_body ../../gcc-trunk/gcc/cp/parser.c:20677 0x71acb1 cp_parser_function_definition_after_declarator ../../gcc-trunk/gcc/cp/parser.c:25309 0x71b904 cp_parser_function_definition_from_specifiers_and_declarator ../../gcc-trunk/gcc/cp/parser.c:25221 0x71b904 cp_parser_init_declarator ../../gcc-trunk/gcc/cp/parser.c:18419 0x71bb1b cp_parser_simple_declaration ../../gcc-trunk/gcc/cp/parser.c:12359 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. $ --------------------------- void fn1 () { __atomic_fetch_add (); }