[Bug c++/68767] [6 regression] spurious warning: null argument where non-null required

2016-01-19 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68767

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #14 from Jakub Jelinek  ---
Fixed.

[Bug c++/68767] [6 regression] spurious warning: null argument where non-null required

2016-01-18 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68767

--- Comment #13 from Jason Merrill  ---
Author: jason
Date: Mon Jan 18 15:54:14 2016
New Revision: 232522

URL: https://gcc.gnu.org/viewcvs?rev=232522=gcc=rev
Log:
PR c++/68767
gcc/c-family/
* c-common.c (check_function_arguments_recurse): Fold the whole
COND_EXPR, not just the condition.
gcc/cp/
* cp-gimplify.c (cp_fold) [COND_EXPR]: Simplify.  Do fold COND_EXPR.
(contains_label_1, contains_label_p): Remove.

Added:
trunk/gcc/testsuite/g++.dg/warn/Wnonnull2.C
Modified:
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c-common.c
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cp-gimplify.c

[Bug c++/68767] [6 regression] spurious warning: null argument where non-null required

2016-01-15 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68767

Jason Merrill  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |jason at gcc dot gnu.org

[Bug c++/68767] [6 regression] spurious warning: null argument where non-null required

2016-01-15 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68767

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #9 from Jakub Jelinek  ---
The original testcase fails all the way back to r11 or so, don't have older
snapshots around.
The #c4 one also failed since forever, started to pass with r217465 and then
reappeared with C++ delayed folding r230365.

[Bug c++/68767] [6 regression] spurious warning: null argument where non-null required

2016-01-15 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68767

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jason at gcc dot gnu.org

--- Comment #10 from Jakub Jelinek  ---
I think the problem here is that check_function_arguments_recurse just folds
using fold_for_warn the condition, if instead of folding the condition the
check_function_nonnull caller of check_function_arguments_recurse would
fold_for_warn the whole argument and only then call
check_function_arguments_recurse on it, it would rule out the NULL argument
from there.  But the disadvantage of that is that then we'd be warning on
perhaps completely newly created trees that perhaps don't match very match the
original, something the delayed folding rightly wants to avoid.
Perhaps one option would be to do the non-NULL warning in two steps, where the
first step is fold_for_warn the whole argument, recurse on it with a variant
that will not fold_for_warn recursively (not needed) and just note if there is
a need to warn instead of actually warning.  And then, if this pass returned
there is a reason to warn, call what we do now on the unfolded argument.
Of course, the question is if the warning isn't really desirable, the user
should really just choose some non-NULL magic value to pass in the impossible
cases.

[Bug c++/68767] [6 regression] spurious warning: null argument where non-null required

2016-01-15 Thread amylaar at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68767

--- Comment #11 from Jorn Wolfgang Rennecke  ---
(In reply to Jakub Jelinek from comment #10)
 > Of course, the question is if the warning isn't really desirable, the user
> should really just choose some non-NULL magic value to pass in the
> impossible cases.

Are you saying the *_TYPE definitions in newlib-stdint.h should not use 0 in
any branches of their expressions?

[Bug c++/68767] [6 regression] spurious warning: null argument where non-null required

2016-01-15 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68767

--- Comment #12 from Jakub Jelinek  ---
(In reply to Jorn Wolfgang Rennecke from comment #11)
> (In reply to Jakub Jelinek from comment #10)
>  > Of course, the question is if the warning isn't really desirable, the user
> > should really just choose some non-NULL magic value to pass in the
> > impossible cases.
> 
> Are you saying the *_TYPE definitions in newlib-stdint.h should not use 0 in
> any branches of their expressions?

If you pass such *_TYPE definitions to functions with nonnull argument, maybe
yes.  Find out some other invalid type, like "".

[Bug c++/68767] [6 regression] spurious warning: null argument where non-null required

2016-01-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68767

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P1

--- Comment #8 from Richard Biener  ---
May want to decide to give up later (INVALID, expected false positive)

[Bug c++/68767] [6 regression] spurious warning: null argument where non-null required

2016-01-05 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68767

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |6.0

[Bug c++/68767] [6 regression] spurious warning: null argument where non-null required

2015-12-09 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68767

Martin Sebor  changed:

   What|Removed |Added

Summary|[5 regression] spurious |[6 regression] spurious
   |warning: null argument  |warning: null argument
   |where non-null required |where non-null required

--- Comment #7 from Martin Sebor  ---
You're right, it's a 6 regression, thanks.  I'll see if I can look into the
possibility of the delayed folding merge as the culprit.