http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58702
Bug ID: 58702 Summary: [4.9 Regression] ICE with undeclared variable in OpenMP 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: ============================================= void foo() { x; #pragma omp parallel for reduction(+:x) for (int i = 0; i < 10; ++i) ; } ============================================= bug.cc: In function 'void foo()': bug.cc:3:3: error: 'x' was not declared in this scope x; ^ bug.cc:4:40: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in finish_omp_reduction_clause, at cp/semantics.c:4966 #pragma omp parallel for reduction(+:x) ^ 0xd14f79 tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*) ../../gcc/gcc/tree.c:9351 0x6df624 tree_class_check ../../gcc/gcc/tree.h:2797 0x6df624 finish_omp_reduction_clause ../../gcc/gcc/cp/semantics.c:4966 0x6df624 finish_omp_clauses(tree_node*) ../../gcc/gcc/cp/semantics.c:5709 0x634b1e cp_omp_split_clauses ../../gcc/gcc/cp/parser.c:28967 0x66873e cp_parser_omp_for ../../gcc/gcc/cp/parser.c:29079 0x668c4b cp_parser_omp_parallel ../../gcc/gcc/cp/parser.c:29259 0x63f221 cp_parser_omp_construct ../../gcc/gcc/cp/parser.c:30380 0x63f221 cp_parser_pragma ../../gcc/gcc/cp/parser.c:30885 0x64555c cp_parser_statement ../../gcc/gcc/cp/parser.c:9297 0x646342 cp_parser_statement_seq_opt ../../gcc/gcc/cp/parser.c:9604 0x646486 cp_parser_compound_statement ../../gcc/gcc/cp/parser.c:9558 0x659b0b cp_parser_function_body ../../gcc/gcc/cp/parser.c:18401 0x659b0b cp_parser_ctor_initializer_opt_and_function_body ../../gcc/gcc/cp/parser.c:18437 0x65df0f cp_parser_function_definition_after_declarator ../../gcc/gcc/cp/parser.c:22444 0x65ece2 cp_parser_function_definition_from_specifiers_and_declarator ../../gcc/gcc/cp/parser.c:22365 0x65ece2 cp_parser_init_declarator ../../gcc/gcc/cp/parser.c:16412 0x65ff2f cp_parser_simple_declaration ../../gcc/gcc/cp/parser.c:11047 0x643860 cp_parser_block_declaration ../../gcc/gcc/cp/parser.c:10928 0x66aaae cp_parser_declaration ../../gcc/gcc/cp/parser.c:10825 Please submit a full bug report, [etc.] The regression was introduced between 2013-10-09 and 2013-10-11.