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

--- Comment #4 from Sergei Trofimovich <slyfox at inbox dot ru> ---
If I read backtrace function names correctly crash happened when openmp for was
expanded and one of arguments was not recognised early enough as invalid (value
vs. function pointer?).

Thread 2.1 "cc1plus" hit Breakpoint 1, internal_error
(gmsgid=gmsgid@entry=0x1c53558 "tree check: expected tree that contains %qs
structure, have %qs in %s, at %s:%d")
    at ../../gcc/gcc/diagnostic.c:1577
1577    {
(gdb) bt
#0  internal_error (gmsgid=gmsgid@entry=0x1c53558 "tree check: expected tree
that contains %qs structure, have %qs in %s, at %s:%d") at
../../gcc/gcc/diagnostic.c:1577
#1  0x00000000011f74ff in tree_contains_struct_check_failed
(node=node@entry=0x7ffff785ecf0, en=en@entry=TS_DECL_COMMON,
file=file@entry=0x1bc5954 "../../gcc/gcc/expr.c",
    line=line@entry=7238, function=function@entry=0x1bc5b35
"get_inner_reference") at ../../gcc/gcc/tree.c:9858
#2  0x0000000000ac66a5 in contains_struct_check (__g=0x1bc5b35
"get_inner_reference", __l=7238, __f=0x1bc5954 "../../gcc/gcc/expr.c",
__s=TS_DECL_COMMON, __t=0x7ffff785ecf0)
    at ../../gcc/gcc/tree.h:3387
#3  get_inner_reference (exp=exp@entry=0x7ffff785ed20,
pbitsize=pbitsize@entry=0x7fffffffc1c0, pbitpos=pbitpos@entry=0x7fffffffc1a0,
poffset=poffset@entry=0x7fffffffc198,
    pmode=pmode@entry=0x7fffffffc148,
punsignedp=punsignedp@entry=0x7fffffffc158, preversep=0x7fffffffc168,
pvolatilep=0x7fffffffc178) at ../../gcc/gcc/expr.c:7238
#4  0x0000000000b1d0bd in optimize_bit_field_compare (rhs=0x7ffff7ffbc60,
lhs=0x7ffff785ed20, compare_type=0x7ffff787eb28, code=NE_EXPR, loc=2147483649)
    at ../../gcc/gcc/fold-const.c:4443
#5  fold_binary_loc (loc=loc@entry=2147483649, code=code@entry=NE_EXPR,
type=type@entry=0x7ffff787eb28, op0=op0@entry=0x7ffff785ed20,
op1=op1@entry=0x7ffff7ffbc60)
    at ../../gcc/gcc/fold-const.c:11091
#6  0x0000000000b209f4 in fold_build2_loc (loc=loc@entry=2147483649,
code=code@entry=NE_EXPR, type=type@entry=0x7ffff787eb28,
op0=op0@entry=0x7ffff785ed20,
    op1=op1@entry=0x7ffff7ffbc60) at ../../gcc/gcc/fold-const.c:12720
#7  0x0000000000b17862 in fold_binary_loc (loc=2147483649, code=NE_EXPR,
type=0x7ffff787eb28, op0=0x7ffff7ffbc60, op1=0x7ffff785ed20) at
../../gcc/gcc/fold-const.c:9729
#8  0x0000000000b3fce2 in fold (expr=expr@entry=0x7ffff79c8ca8) at
../../gcc/gcc/fold-const.c:12342
#9  0x0000000000652a56 in cp_fold (x=<optimized out>) at
../../gcc/gcc/cp/cp-gimplify.c:2534
#10 0x0000000000654ca2 in cp_fold_maybe_rvalue (x=<optimized out>,
rval=rval@entry=true) at ../../gcc/gcc/cp/cp-gimplify.c:2210
#11 0x0000000000654d41 in cp_fold_rvalue (x=<optimized out>) at
../../gcc/gcc/cp/cp-gimplify.c:2233
#12 0x0000000000654d8e in cp_fully_fold (x=<optimized out>,
x@entry=0x7ffff79c8ca8) at ../../gcc/gcc/cp/cp-gimplify.c:2257
#13 0x00000000008214b7 in handle_omp_for_class_iterator (i=i@entry=0,
locus=locus@entry=24706, code=code@entry=OMP_FOR,
declv=declv@entry=0x7ffff79b8ae0,
    orig_declv=orig_declv@entry=0x7ffff79b8d20,
initv=initv@entry=0x7ffff79b8b00, condv=0x7ffff79b8b20, incrv=0x7ffff79b8b40,
body=0x7fffffffc818, pre_body=0x7fffffffc810,
    clauses=@0x7fffffffc808: 0x0, collapse=1, ordered=0) at
../../gcc/gcc/cp/semantics.c:8437
#14 0x0000000000834bb6 in finish_omp_for (locus=locus@entry=24706,
code=code@entry=OMP_FOR, declv=declv@entry=0x7ffff79b8ae0,
orig_declv=0x7ffff79b8d20, orig_declv@entry=0x0,
    initv=initv@entry=0x7ffff79b8b00, condv=condv@entry=0x7ffff79b8b20,
incrv=0x7ffff79b8b40, body=<optimized out>, pre_body=<optimized out>,
orig_inits=0x7fffffffc9a0,
    clauses=<optimized out>) at ../../gcc/gcc/cp/semantics.c:8948
#15 0x000000000077db3f in cp_parser_omp_for_loop
(parser=parser@entry=0x7ffff788e7b8, code=code@entry=OMP_FOR,
clauses=<optimized out>, clauses@entry=0x0,
    cclauses=cclauses@entry=0x0, if_p=if_p@entry=0x0) at
../../gcc/gcc/cp/parser.c:38279
#16 0x000000000077e4e1 in cp_parser_omp_for
(parser=parser@entry=0x7ffff788e7b8,
pragma_tok=pragma_tok@entry=0x7ffff77de118, p_name=<optimized out>,
    p_name@entry=0x7fffffffcb90 "#pragma omp for", mask=...,
cclauses=cclauses@entry=0x0, if_p=0x0) at ../../gcc/gcc/cp/parser.c:38526
#17 0x0000000000780f2d in cp_parser_omp_construct
(parser=parser@entry=0x7ffff788e7b8,
pragma_tok=pragma_tok@entry=0x7ffff77de118, if_p=if_p@entry=0x0)
    at ../../gcc/gcc/cp/parser.c:42102
#18 0x0000000000759509 in cp_parser_pragma (parser=parser@entry=0x7ffff788e7b8,
context=context@entry=pragma_compound, if_p=if_p@entry=0x0) at
../../gcc/gcc/cp/parser.c:42763
#19 0x000000000075b59f in cp_parser_statement
(parser=parser@entry=0x7ffff788e7b8,
in_statement_expr=in_statement_expr@entry=0x0,
in_compound=in_compound@entry=true,
    if_p=if_p@entry=0x0, chain=chain@entry=0x0,
loc_after_labels=loc_after_labels@entry=0x0) at ../../gcc/gcc/cp/parser.c:11354
#20 0x000000000075b80c in cp_parser_statement_seq_opt
(parser=parser@entry=0x7ffff788e7b8,
in_statement_expr=in_statement_expr@entry=0x0) at
../../gcc/gcc/cp/parser.c:11742
#21 0x000000000075b8e1 in cp_parser_compound_statement
(parser=parser@entry=0x7ffff788e7b8,
in_statement_expr=in_statement_expr@entry=0x0, bcs_flags=bcs_flags@entry=0,
    function_body=function_body@entry=true) at ../../gcc/gcc/cp/parser.c:11696
#22 0x0000000000772504 in cp_parser_function_body (in_function_try_block=false,
parser=0x7ffff788e7b8) at ../../gcc/gcc/cp/parser.c:22917
#23 cp_parser_ctor_initializer_opt_and_function_body
(parser=parser@entry=0x7ffff788e7b8,
in_function_try_block=in_function_try_block@entry=false) at
../../gcc/gcc/cp/parser.c:22917
#24 0x00000000007762c1 in cp_parser_function_definition_after_declarator
(parser=parser@entry=0x7ffff788e7b8, inline_p=inline_p@entry=false) at
../../gcc/gcc/cp/parser.c:28585
#25 0x0000000000776919 in
cp_parser_function_definition_from_specifiers_and_declarator
(declarator=0x27649e0, attributes=0x0, decl_specifiers=0x7fffffffcd10,
parser=0x7ffff788e7b8)
    at ../../gcc/gcc/cp/parser.c:28502
#26 cp_parser_init_declarator (parser=parser@entry=0x7ffff788e7b8,
flags=<optimized out>, flags@entry=0,
decl_specifiers=decl_specifiers@entry=0x7fffffffcfd0,
    checks=checks@entry=0x0,
function_definition_allowed_p=function_definition_allowed_p@entry=true,
member_p=member_p@entry=false, declares_class_or_enum=0,
    function_definition_p=0x7fffffffcfc0, maybe_range_for_decl=0x0,
init_loc=0x7fffffffcfbc, auto_result=0x7fffffffcfc8) at
../../gcc/gcc/cp/parser.c:20495
#27 0x0000000000777c50 in cp_parser_simple_declaration
(parser=parser@entry=0x7ffff788e7b8, function_definition_allowed_p=<optimized
out>,
    maybe_range_for_decl=maybe_range_for_decl@entry=0x0) at
../../gcc/gcc/cp/parser.c:13624
#28 0x0000000000778426 in cp_parser_block_declaration
(parser=parser@entry=0x7ffff788e7b8, statement_p=statement_p@entry=false) at
../../gcc/gcc/cp/parser.c:13449
#29 0x0000000000786646 in cp_parser_declaration
(parser=parser@entry=0x7ffff788e7b8) at ../../gcc/gcc/cp/parser.c:13322
#30 0x00000000007866c7 in cp_parser_toplevel_declaration
(parser=parser@entry=0x7ffff788e7b8) at ../../gcc/gcc/cp/parser.c:13350
#31 0x0000000000786b87 in cp_parser_translation_unit (parser=0x7ffff788e7b8) at
../../gcc/gcc/cp/parser.c:4721
#32 c_parse_file () at ../../gcc/gcc/cp/parser.c:42925
#33 0x0000000000907ca7 in c_common_parse_file () at
../../gcc/gcc/c-family/c-opts.c:1185
#34 0x0000000000ebe161 in compile_file () at ../../gcc/gcc/toplev.c:458
#35 0x0000000000ec0e68 in do_compile () at ../../gcc/gcc/toplev.c:2279
#36 toplev::main (this=this@entry=0x7fffffffd416, argc=<optimized out>,
argc@entry=14, argv=<optimized out>, argv@entry=0x7fffffffd518) at
../../gcc/gcc/toplev.c:2414
#37 0x0000000001a5be9e in main (argc=14, argv=0x7fffffffd518) at
../../gcc/gcc/main.c:39

Reply via email to