https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122982
--- Comment #2 from qinzhao at gcc dot gnu.org ---
in the original IR generated by C FE:
int * p = .ACCESS_WITH_SIZE (<<< Unknown tree: c_maybe_const_expr
<<< Unknown tree: compound_literal_expr
struct __bounded_ptr D.4597 = {.k=3, .buf=f1 (3)}; >>> >>>.buf,
&<<< Unknown tree: compound_literal_expr
struct __bounded_ptr D.4597 = {.k=3, .buf=f1 (3)}; >>>.k, 0B, 4);
struct __bounded_ptr D.4597 = {.k=3, .buf=f1 (3)};
In the above, the "c_maybe_const_expr" is the one that triggered the ICE since
the gimplification phase in middle-end does not recognize this C specific IR.
The "c_maybe_const_expr" should be folded in the C FE.
this is a bug in the routine "build_access_with_size_for_counted_by" in the
following source code:
3187 tree first_param = is_fam
3188 ? c_fully_fold (array_to_pointer_conversion (loc,
ref),
3189 false, NULL)
3190 : ref;
we should apply "c_fully_fold" too when is_fam is false. i.e:
3187 tree first_param = is_fam
3188 ? c_fully_fold (array_to_pointer_conversion (loc,
ref),
3189 false, NULL)
3190 : c_fully_fold (ref, false, NULL);
this fixed the ICE.