https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81737
Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mpolacek at gcc dot gnu.org --- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> --- Untested, but this should fix it: --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -14107,8 +14107,10 @@ fold_indirect_ref_1 (location_t loc, tree type, tree op0) && type == TREE_TYPE (op00type)) { tree type_domain = TYPE_DOMAIN (op00type); - tree min = TYPE_MIN_VALUE (type_domain); - if (min && TREE_CODE (min) == INTEGER_CST) + tree min; + if (type_domain != NULL_TREE + && (min = TYPE_MIN_VALUE (type_domain)) + && TREE_CODE (min) == INTEGER_CST) { offset_int off = wi::to_offset (op01); offset_int el_sz = wi::to_offset (TYPE_SIZE_UNIT (type));