http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59628
Bug ID: 59628 Summary: ICE with invalid OpenMP "declare reduction" clause Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: reichelt at gcc dot gnu.org The following invalid code snippet (compiled with "-fopenmp") triggers an ICE on trunk since 2013-10-11: ============================================================== struct A { int i; }; void foo() { A a; #pragma omp declare reduction (+: A: omp_out.i +: omp_in.i) #pragma omp parallel reduction (+: a) ; } ============================================================== bug.cc: In function 'void foo()': bug.cc:6:51: error: expected primary-expression before ':' token #pragma omp declare reduction (+: A: omp_out.i +: omp_in.i) ^ bug.cc:6:51: error: expected ')' before ':' token bug.cc:7:40: internal compiler error: Segmentation fault #pragma omp parallel reduction (+: a) ^ 0xb75baf crash_signal ../../gcc/gcc/toplev.c:336 0x713397 finish_omp_reduction_clause ../../gcc/gcc/cp/semantics.c:5023 0x713397 finish_omp_clauses(tree_node*) ../../gcc/gcc/cp/semantics.c:5751 0x686027 cp_parser_omp_all_clauses ../../gcc/gcc/cp/parser.c:28155 0x513e4e cp_parser_omp_parallel ../../gcc/gcc/cp/parser.c:29603 0x674827 cp_parser_omp_construct ../../gcc/gcc/cp/parser.c:30723 0x674827 cp_parser_pragma ../../gcc/gcc/cp/parser.c:31228 0x67ac2c cp_parser_statement ../../gcc/gcc/cp/parser.c:9433 0x67b5c9 cp_parser_statement_seq_opt ../../gcc/gcc/cp/parser.c:9740 0x67b73e cp_parser_compound_statement ../../gcc/gcc/cp/parser.c:9694 0x68f15b cp_parser_function_body ../../gcc/gcc/cp/parser.c:18610 0x68f15b cp_parser_ctor_initializer_opt_and_function_body ../../gcc/gcc/cp/parser.c:18646 0x6934fe cp_parser_function_definition_after_declarator ../../gcc/gcc/cp/parser.c:22678 0x694394 cp_parser_function_definition_from_specifiers_and_declarator ../../gcc/gcc/cp/parser.c:22590 0x694394 cp_parser_init_declarator ../../gcc/gcc/cp/parser.c:16588 0x69562f cp_parser_simple_declaration ../../gcc/gcc/cp/parser.c:11200 0x679003 cp_parser_block_declaration ../../gcc/gcc/cp/parser.c:11081 0x69fcd3 cp_parser_declaration ../../gcc/gcc/cp/parser.c:10978 0x69e9c8 cp_parser_declaration_seq_opt ../../gcc/gcc/cp/parser.c:10864 0x6a02ba cp_parser_translation_unit ../../gcc/gcc/cp/parser.c:4018 Please submit a full bug report, [etc.] Jakub, this appeared right after your big OpenMP 4.0 patch (where "omp declare reduction" was introduced): 2013-10-11 Jakub Jelinek <ja...@redhat.com> * decl.c (duplicate_decls): Error out for redeclaration of UDRs. (declare_simd_adjust_this): New function. (grokfndecl): If "omp declare simd" attribute is present, call declare_simd_adjust_this if needed and c_omp_declare_simd_clauses_to_numbers. [...] Would you mind having a look?