[Bug middle-end/68767] spurious warning: null argument where non-null required
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Dec 8 16:54:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68767
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Reduced:
extern int len (const char *__s) __attribute__ ((__nonnull__ (1)));
extern int num;
int
f (void)
{
return len (num != 2 ? "a" : 0);
}
Looks like it's been like this forever. We're hitting:
9752 if (TREE_CODE (param) == COND_EXPR)
9753 {
9754 tree cond = fold_for_warn (TREE_OPERAND (param, 0));
9755 /* Check both halves of the conditional expression. */
9756 if (!integer_zerop (cond))
9757 check_function_arguments_recurse (callback, ctx,
9758 TREE_OPERAND (param, 1),
param_num);
9759 if (!integer_nonzerop (cond))
9760 check_function_arguments_recurse (callback, ctx,
9761 TREE_OPERAND (param, 2),
param_num);
9762 return;
9763 }
More information about the Gcc-bugs
mailing list