* [Bug c++/65323] -Wzero-as-null-pointer-constant stutters
2015-03-05 10:12 [Bug c++/65323] New: -Wzero-as-null-pointer-constant stutters akim.demaille at gmail dot com
@ 2015-03-05 20:57 ` paolo.carlini at oracle dot com
2015-03-05 21:04 ` paolo.carlini at oracle dot com
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-03-05 20:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65323
--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
This one should be easy to fix.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/65323] -Wzero-as-null-pointer-constant stutters
2015-03-05 10:12 [Bug c++/65323] New: -Wzero-as-null-pointer-constant stutters akim.demaille at gmail dot com
2015-03-05 20:57 ` [Bug c++/65323] " paolo.carlini at oracle dot com
@ 2015-03-05 21:04 ` paolo.carlini at oracle dot com
2015-03-06 0:17 ` [Bug c++/65323] [4.8/4.9/5 Regression] duplicate -Wzero-as-null-pointer-constant warnings paolo.carlini at oracle dot com
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-03-05 21:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65323
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |paolo.carlini at oracle dot com
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/65323] [4.8/4.9/5 Regression] duplicate -Wzero-as-null-pointer-constant warnings
2015-03-05 10:12 [Bug c++/65323] New: -Wzero-as-null-pointer-constant stutters akim.demaille at gmail dot com
2015-03-05 20:57 ` [Bug c++/65323] " paolo.carlini at oracle dot com
2015-03-05 21:04 ` paolo.carlini at oracle dot com
@ 2015-03-06 0:17 ` paolo.carlini at oracle dot com
2015-03-09 14:43 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-03-06 0:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65323
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|-Wzero-as-null-pointer-cons |[4.8/4.9/5 Regression]
|tant stutters |duplicate
| |-Wzero-as-null-pointer-cons
| |tant warnings
--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
This is in fact a regression which started when check_default_argument got a
perform_implicit_conversion_flags call near the beginning.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/65323] [4.8/4.9/5 Regression] duplicate -Wzero-as-null-pointer-constant warnings
2015-03-05 10:12 [Bug c++/65323] New: -Wzero-as-null-pointer-constant stutters akim.demaille at gmail dot com
` (2 preceding siblings ...)
2015-03-06 0:17 ` [Bug c++/65323] [4.8/4.9/5 Regression] duplicate -Wzero-as-null-pointer-constant warnings paolo.carlini at oracle dot com
@ 2015-03-09 14:43 ` rguenth at gcc dot gnu.org
2015-03-10 14:50 ` ktietz at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-03-09 14:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65323
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Priority|P3 |P2
Target Milestone|--- |4.8.5
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/65323] [4.8/4.9/5 Regression] duplicate -Wzero-as-null-pointer-constant warnings
2015-03-05 10:12 [Bug c++/65323] New: -Wzero-as-null-pointer-constant stutters akim.demaille at gmail dot com
` (3 preceding siblings ...)
2015-03-09 14:43 ` rguenth at gcc dot gnu.org
@ 2015-03-10 14:50 ` ktietz at gcc dot gnu.org
2015-03-10 15:24 ` paolo.carlini at oracle dot com
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: ktietz at gcc dot gnu.org @ 2015-03-10 14:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65323
Kai Tietz <ktietz at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ktietz at gcc dot gnu.org
--- Comment #3 from Kai Tietz <ktietz at gcc dot gnu.org> ---
Hmm, the issue seems to be that we emit within check_default_argument () two
times the call to maybe_warn_zero_as_null_pointer_constant (). Once indirectly
via perform_implicit_conversion_flags () call, and then later on directly
within if-condition for returning nullptr_node.
It seems that second call is superflous in terms of warning. So I suggest the
following patch:
Index: decl.c
===================================================================
--- decl.c (Revision 221277)
+++ decl.c (Arbeitskopie)
@@ -11231,7 +11233,8 @@ check_default_argument (tree decl, tree arg, tsub
&& TYPE_PTR_OR_PTRMEM_P (decl_type)
&& null_ptr_cst_p (arg)
&& (complain & tf_warning)
- && maybe_warn_zero_as_null_pointer_constant (arg, input_location))
+ && c_inhibit_evaluation_warnings == 0
+ && !NULLPTR_TYPE_P(TREE_TYPE (arg)))
return nullptr_node;
/* [dcl.fct.default]
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/65323] [4.8/4.9/5 Regression] duplicate -Wzero-as-null-pointer-constant warnings
2015-03-05 10:12 [Bug c++/65323] New: -Wzero-as-null-pointer-constant stutters akim.demaille at gmail dot com
` (4 preceding siblings ...)
2015-03-10 14:50 ` ktietz at gcc dot gnu.org
@ 2015-03-10 15:24 ` paolo.carlini at oracle dot com
2015-03-12 23:56 ` paolo at gcc dot gnu.org
2015-03-12 23:58 ` [Bug c++/65323] [4.8/4.9 " paolo.carlini at oracle dot com
7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-03-10 15:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65323
--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I sent a patch to the mailing list about this. If we don't want to apply it and
we want to be super-conservative, we can indeed simply do this, with a comment,
in my opinion:
@@ -11227,11 +11243,14 @@
LOOKUP_IMPLICIT);
--cp_unevaluated_operand;
+ /* FIXME: should be OK to just check
+ TYPE_PTR_OR_PTRMEM_P (decl_type) && null_ptr_cst_p (arg). */
if (warn_zero_as_null_pointer_constant
&& TYPE_PTR_OR_PTRMEM_P (decl_type)
&& null_ptr_cst_p (arg)
&& (complain & tf_warning)
- && maybe_warn_zero_as_null_pointer_constant (arg, input_location))
+ && c_inhibit_evaluation_warnings == 0
+ && !NULLPTR_TYPE_P (TREE_TYPE (arg)))
return nullptr_node;
/* [dcl.fct.default]
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/65323] [4.8/4.9/5 Regression] duplicate -Wzero-as-null-pointer-constant warnings
2015-03-05 10:12 [Bug c++/65323] New: -Wzero-as-null-pointer-constant stutters akim.demaille at gmail dot com
` (5 preceding siblings ...)
2015-03-10 15:24 ` paolo.carlini at oracle dot com
@ 2015-03-12 23:56 ` paolo at gcc dot gnu.org
2015-03-12 23:58 ` [Bug c++/65323] [4.8/4.9 " paolo.carlini at oracle dot com
7 siblings, 0 replies; 9+ messages in thread
From: paolo at gcc dot gnu.org @ 2015-03-12 23:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65323
--- Comment #5 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Thu Mar 12 23:55:49 2015
New Revision: 221402
URL: https://gcc.gnu.org/viewcvs?rev=221402&root=gcc&view=rev
Log:
2015-03-12 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/65323
* decl.c (check_default_argument): Don't call
maybe_warn_zero_as_null_pointer_constant.
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/decl.c
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/65323] [4.8/4.9 Regression] duplicate -Wzero-as-null-pointer-constant warnings
2015-03-05 10:12 [Bug c++/65323] New: -Wzero-as-null-pointer-constant stutters akim.demaille at gmail dot com
` (6 preceding siblings ...)
2015-03-12 23:56 ` paolo at gcc dot gnu.org
@ 2015-03-12 23:58 ` paolo.carlini at oracle dot com
7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-03-12 23:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65323
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Target Milestone|4.8.5 |5.0
Summary|[4.8/4.9/5 Regression] |[4.8/4.9 Regression]
|duplicate |duplicate
|-Wzero-as-null-pointer-cons |-Wzero-as-null-pointer-cons
|tant warnings |tant warnings
--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed for 5.0, not worth fixing in 4.8/4.9.
^ permalink raw reply [flat|nested] 9+ messages in thread