https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61963
Bug ID: 61963 Summary: CilkPlus Array Notation ICE in build_array_notation_ref on malformed function arguments. Product: gcc Version: 4.10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other Assignee: unassigned at gcc dot gnu.org Reporter: nick.tomlinson at arm dot com Created attachment 33212 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33212&action=edit A minimal reproducer GCC ICEs when presented with a malformed function argument list, and two (or more) uses of the parameter in array notation. ==== Steps to reproduce ==== - Build with: g++ -fcilkplus -c arrayice.cpp - Observe that an ICE is produced. ==== What I expected to happen ==== - g++ should produce an error message, but without ICEing. ==== What actually happened ==== - Trunk g++ produced the following output: $ ${GCC_TRUNK}/bin/g++ -fcilkplus -c arrayice.cpp arrayice.cpp:3:15: error: expected ',' or '...' before 'int' void f (int * int *a) ^ arrayice.cpp: In function 'void f(int*)': arrayice.cpp:7:3: error: 'a' was not declared in this scope a[0:64] = 0; ^ arrayice.cpp:8:9: internal compiler error: in build_array_notation_ref, at cp/cp-array-notation.c:1396 a[0:64] = 0; ^ 0x74c12a build_array_notation_ref(unsigned int, tree_node*, tree_node*, tree_node*, tree_node*, tree_node*) /home/nicholas/GCCCilk/bug/native/gcc-4.9.0/gcc/cp/cp-array-notation.c:1396 0x65d94f cp_parser_array_notation /home/nicholas/GCCCilk/bug/native/gcc-4.9.0/gcc/cp/parser.c:6388 0x65d94f cp_parser_postfix_open_square_expression /home/nicholas/GCCCilk/bug/native/gcc-4.9.0/gcc/cp/parser.c:6453 0x65d94f cp_parser_postfix_expression /home/nicholas/GCCCilk/bug/native/gcc-4.9.0/gcc/cp/parser.c:6053 0x660968 cp_parser_unary_expression /home/nicholas/GCCCilk/bug/native/gcc-4.9.0/gcc/cp/parser.c:7293 0x661599 cp_parser_binary_expression /home/nicholas/GCCCilk/bug/native/gcc-4.9.0/gcc/cp/parser.c:8036 0x661b6b cp_parser_assignment_expression /home/nicholas/GCCCilk/bug/native/gcc-4.9.0/gcc/cp/parser.c:8279 0x664213 cp_parser_expression /home/nicholas/GCCCilk/bug/native/gcc-4.9.0/gcc/cp/parser.c:8441 0x664a3c cp_parser_expression /home/nicholas/GCCCilk/bug/native/gcc-4.9.0/gcc/cp/parser.c:8480 0x664a3c cp_parser_expression_statement /home/nicholas/GCCCilk/bug/native/gcc-4.9.0/gcc/cp/parser.c:9819 0x6595e8 cp_parser_statement /home/nicholas/GCCCilk/bug/native/gcc-4.9.0/gcc/cp/parser.c:9670 0x65a3f9 cp_parser_statement_seq_opt /home/nicholas/GCCCilk/bug/native/gcc-4.9.0/gcc/cp/parser.c:9942 0x65a566 cp_parser_compound_statement /home/nicholas/GCCCilk/bug/native/gcc-4.9.0/gcc/cp/parser.c:9896 0x66ba4b cp_parser_function_body /home/nicholas/GCCCilk/bug/native/gcc-4.9.0/gcc/cp/parser.c:18961 0x66ba4b cp_parser_ctor_initializer_opt_and_function_body /home/nicholas/GCCCilk/bug/native/gcc-4.9.0/gcc/cp/parser.c:18997 0x6720f3 cp_parser_function_definition_after_declarator /home/nicholas/GCCCilk/bug/native/gcc-4.9.0/gcc/cp/parser.c:23162 0x672fae cp_parser_function_definition_from_specifiers_and_declarator /home/nicholas/GCCCilk/bug/native/gcc-4.9.0/gcc/cp/parser.c:23074 0x672fae cp_parser_init_declarator /home/nicholas/GCCCilk/bug/native/gcc-4.9.0/gcc/cp/parser.c:16824 0x674195 cp_parser_simple_declaration /home/nicholas/GCCCilk/bug/native/gcc-4.9.0/gcc/cp/parser.c:11421 0x657da3 cp_parser_block_declaration /home/nicholas/GCCCilk/bug/native/gcc-4.9.0/gcc/cp/parser.c:11302 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. - My system GCC produces the following output: $ g++ -fcilkplus -c arrayice.cpp arrayice.cpp:3:15: error: expected ',' or '...' before 'int' void f (int * int *a) ^ arrayice.cpp: In function 'void f(int*)': arrayice.cpp:7:3: error: 'a' was not declared in this scope a[0:64] = 0; ^ arrayice.cpp:8: confused by earlier errors, bailing out ==== Environment ==== I have tried this with: - My system GCC (g++, version 4.9.1) - A native build of GCC (${GCC_TRUNK}/bin/g++, revision r213234) ${GCC_TRUNK}/bin/g++ is a native build of GCC, with the following specified to the configure script: ./configure --prefix=${GCC_TRUNK} \ --enable-languages=c,c++,fortran --disable-sjlj-exceptions And make invoked as: make CXXFLAGS="-g3 -O0" -j9 $ uname -a Linux squamata 3.15.7-1-ARCH #1 SMP PREEMPT Mon Jul 28 20:06:17 CEST 2014 x86_64 GNU/Linux $ g++ --version g++ (GCC) 4.9.1 Copyright (C) 2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ ${GCC_TRUNK}/bin/g++ --version g++ (GCC) 4.10.0 20140730 (experimental) Copyright (C) 2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.