https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67133
--- Comment #13 from Marek Polacek <mpolacek at gcc dot gnu.org> --- Or --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -2684,8 +2684,10 @@ infer_nonnull_range_by_attribute (gimple stmt, tree op) { for (unsigned int i = 0; i < gimple_call_num_args (stmt); i++) { - if (POINTER_TYPE_P (TREE_TYPE (gimple_call_arg (stmt, i))) - && operand_equal_p (op, gimple_call_arg (stmt, i), 0)) + tree arg = gimple_call_arg (stmt, i); + if (TREE_TYPE (arg) + && POINTER_TYPE_P (TREE_TYPE (arg)) + && operand_equal_p (op, arg, 0)) return true; } return false;