https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124227

            Bug ID: 124227
           Summary: ICE at cp/typeck.cc:113 (Reflection + OpenMP)
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc-bugs at deta dot lv
  Target Milestone: ---

Created attachment 63778
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63778&action=edit
reduced test case

Hello!

A combination of `-freflection` and `-fopenmp` triggers an ICE.
No actual reflection constructs in the code.

--------------------------------------
eq-2D.ii: In function ‘void omp declare reduction d~1cIfE(c<float>&)’:
eq-2D.ii:3:46: warning: statement has no effect [-Wunused-value]
    3 | #pragma omp declare reduction(d : c<float> : omp_in)
      |                                              ^~~~~~
eq-2D.ii: In lambda function:
eq-2D.ii:5:6: warning: unused variable ‘acc’ [-Wunused-variable]
    5 | c<b> acc;
      |      ^~~
eq-2D.ii:9:1: internal compiler error: tree check: expected class ‘type’, have
‘exceptional’ (tree_vec) in complete_type, at cp/typeck.cc:113
    9 | };
      | ^
0x2b61a3f internal_error(char const*, ...)
        ../../gcc/diagnostic-global-context.cc:787
0xa8e650 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        ../../gcc/tree.cc:9269
0x914af3 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
        ../../gcc/tree.h:3925
0x914af3 complete_type(tree_node*)
        ../../gcc/cp/typeck.cc:113
0xe88951 consteval_only_p(tree_node*)
        ../../gcc/cp/reflect.cc:8090
0xe88ae8 check_out_of_consteval_use_r
        ../../gcc/cp/reflect.cc:8144
0x1a1914e walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
        ../../gcc/tree.cc:11742
0xe88d9e check_out_of_consteval_use(tree_node*, bool)
        ../../gcc/cp/reflect.cc:8198
0xc5dc17 cp_fold_immediate_r
        ../../gcc/cp/cp-gimplify.cc:1372
0x1a1914e walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
        ../../gcc/tree.cc:11742
0xc5df99 cp_fold_function(tree_node*)
        ../../gcc/cp/cp-gimplify.cc:1750
0xcb3167 finish_function(bool)
        ../../gcc/cp/decl.cc:20644
0xd016f8 finish_lambda_function(tree_node*)
        ../../gcc/cp/lambda.cc:1995
0xdded27 cp_parser_lambda_body
        ../../gcc/cp/parser.cc:13745
0xdded27 cp_parser_lambda_expression
        ../../gcc/cp/parser.cc:12864
0xde0991 cp_parser_primary_expression
        ../../gcc/cp/parser.cc:6813
0xdcbb54 cp_parser_postfix_expression
        ../../gcc/cp/parser.cc:8908
0xdc8196 cp_parser_unary_expression
        ../../gcc/cp/parser.cc:10624
0xdaae78 cp_parser_cast_expression
        ../../gcc/cp/parser.cc:11539
0xdabf9e cp_parser_binary_expression
        ../../gcc/cp/parser.cc:11642
/usr/local/libexec/gcc/x86_64-pc-linux-gnu/16.0.1/cc1plus -fpreprocessed
eq-2D.ii -quiet -dumpbase eq-2D.ii -dumpbase-ext .ii -mtune=generic
-march=x86-64 -Wall -Wextra -std=c++26 -freflection -fopenmp -o /tmp/cc8YoBcY.s
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
--------------------------------------

A reduced (hopefully, not too much) source attached.
The source compiles w/o either `-freflection` or `-fopenmp`.

command line:
g++ -Wall -Wextra -std=c++26 -freflection -fopenmp -c eq-2D.ii

BR,
AZ

Reply via email to