public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96021] New: missing -Wnonnull passing nullptr to a nonnull variadic lambda
@ 2020-07-01 16:24 msebor at gcc dot gnu.org
2020-07-01 16:26 ` [Bug c++/96021] " msebor at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-07-01 16:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96021
Bug ID: 96021
Summary: missing -Wnonnull passing nullptr to a nonnull
variadic lambda
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
G++ issues -Wnonnull when passing nullptr to ordinary variadic functions but
not for the same problem involving variadic lambdas or unspecialized templates.
I believe the problem is due to the -Wnonull warning checking for arguments of
pointer types and the nullptr constant not having such a type.
$ cat q.C && gcc -O2 -S -Wall q.C
__attribute__ ((nonnull)) void f (int, ...);
void ff ()
{
f (1, nullptr); // -Wnonnull (good)
}
template <class T> void g (T t)
{
t (1, nullptr); // missing -Wnonnull
}
void gg (void)
{
g ([](int, auto...) __attribute__ ((nonnull)) { });
}
template <class T> __attribute__ ((nonnull)) void h (T);
void hh ()
{
h (nullptr); // missing -Wnonnull
}
q.C: In function ‘void ff()’:
q.C:4:16: warning: argument 2 null where non-null expected [-Wnonnull]
4 | f (1, nullptr); // -Wnonnull (good)
| ^
q.C:1:32: note: in a call to function ‘void f(int, ...)’ declared ‘nonnull’
1 | __attribute__ ((nonnull)) void f (int, ...);
| ^
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/96021] missing -Wnonnull passing nullptr to a nonnull variadic lambda
2020-07-01 16:24 [Bug c++/96021] New: missing -Wnonnull passing nullptr to a nonnull variadic lambda msebor at gcc dot gnu.org
@ 2020-07-01 16:26 ` msebor at gcc dot gnu.org
2020-07-01 19:07 ` msebor at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-07-01 16:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96021
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|11.0 |8.4.1
Known to fail| |10.1.0, 11.0, 8.4.0, 9.3.0
Keywords| |diagnostic
Blocks| |95507
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
This has never worked as expected.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95507
[Bug 95507] [meta-bug] bogus/missing -Wnonnull
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/96021] missing -Wnonnull passing nullptr to a nonnull variadic lambda
2020-07-01 16:24 [Bug c++/96021] New: missing -Wnonnull passing nullptr to a nonnull variadic lambda msebor at gcc dot gnu.org
2020-07-01 16:26 ` [Bug c++/96021] " msebor at gcc dot gnu.org
@ 2020-07-01 19:07 ` msebor at gcc dot gnu.org
2020-07-06 21:24 ` cvs-commit at gcc dot gnu.org
2020-07-06 21:26 ` msebor at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-07-01 19:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96021
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org
Last reconfirmed| |2020-07-01
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Fixed in my patch for pr95984.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/96021] missing -Wnonnull passing nullptr to a nonnull variadic lambda
2020-07-01 16:24 [Bug c++/96021] New: missing -Wnonnull passing nullptr to a nonnull variadic lambda msebor at gcc dot gnu.org
2020-07-01 16:26 ` [Bug c++/96021] " msebor at gcc dot gnu.org
2020-07-01 19:07 ` msebor at gcc dot gnu.org
@ 2020-07-06 21:24 ` cvs-commit at gcc dot gnu.org
2020-07-06 21:26 ` msebor at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-06 21:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96021
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Sebor <msebor@gcc.gnu.org>:
https://gcc.gnu.org/g:67a493a0b9e7ce6caba4b8bedf1f3295e477ec00
commit r11-1860-g67a493a0b9e7ce6caba4b8bedf1f3295e477ec00
Author: Martin Sebor <msebor@redhat.com>
Date: Mon Jul 6 15:23:37 2020 -0600
Exclude calls to variadic lambda stubs from -Wnonnull checking (PR
c++/95984).
Resolves:
PR c++/95984 - Internal compiler error: Error reporting routines re-entered
in -Wnonnull on a variadic lamnda
PR c++/96021 - missing -Wnonnull passing nullptr to a nonnull variadic
lambda
gcc/c-family/ChangeLog:
PR c++/95984
* c-common.c (check_function_nonnull): Avoid checking syntesized
calls
to stub lambda objects with null this pointer.
(check_nonnull_arg): Handle C++ nullptr.
gcc/cp/ChangeLog:
PR c++/95984
* call.c (build_over_call): Check calls only when tf_warning is
set.
gcc/testsuite/ChangeLog:
PR c++/95984
* g++.dg/warn/Wnonnull6.C: New test.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/96021] missing -Wnonnull passing nullptr to a nonnull variadic lambda
2020-07-01 16:24 [Bug c++/96021] New: missing -Wnonnull passing nullptr to a nonnull variadic lambda msebor at gcc dot gnu.org
` (2 preceding siblings ...)
2020-07-06 21:24 ` cvs-commit at gcc dot gnu.org
@ 2020-07-06 21:26 ` msebor at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-07-06 21:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96021
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Target Milestone|--- |11.0
Status|ASSIGNED |RESOLVED
--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
Implemented for GCC 11 in r11-1860.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-07-06 21:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-01 16:24 [Bug c++/96021] New: missing -Wnonnull passing nullptr to a nonnull variadic lambda msebor at gcc dot gnu.org
2020-07-01 16:26 ` [Bug c++/96021] " msebor at gcc dot gnu.org
2020-07-01 19:07 ` msebor at gcc dot gnu.org
2020-07-06 21:24 ` cvs-commit at gcc dot gnu.org
2020-07-06 21:26 ` msebor at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).