public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/112428] New: Wnonnull outputs wrong type
@ 2023-11-07 20:24 muecker at gwdg dot de
2023-11-11 9:39 ` [Bug c/112428] " cvs-commit at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: muecker at gwdg dot de @ 2023-11-07 20:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112428
Bug ID: 112428
Summary: Wnonnull outputs wrong type
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: muecker at gwdg dot de
Target Milestone: ---
In the following example the type of the argument if output incorrectly:
int b(int n, char buf[static n][1]);
void foo(int n)
{
b(3, 0);
}
<source>:7:5: warning: argument 2 to 'char[1][static 3]' is null where non-null
expected [-Wnonnull]
7 | b(3, 0);
| ^~~~~~~
<source>:2:5: note: in a call to function 'b'
2 | int b(int n, char buf[static n][1]);
| ^
https://godbolt.org/z/eTe6hWxoM
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/112428] Wnonnull outputs wrong type
2023-11-07 20:24 [Bug c/112428] New: Wnonnull outputs wrong type muecker at gwdg dot de
@ 2023-11-11 9:39 ` cvs-commit at gcc dot gnu.org
2023-11-11 9:41 ` uecker at gcc dot gnu.org
2023-11-11 19:03 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-11 9:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112428
--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Uecker <uecker@gcc.gnu.org>:
https://gcc.gnu.org/g:c58b426d64ac2513dc0ed19165740604e891e9df
commit r14-5353-gc58b426d64ac2513dc0ed19165740604e891e9df
Author: Martin Uecker <uecker@tugraz.at>
Date: Thu Jul 27 13:41:33 2023 +0200
c: Synthesize nonnull attribute for parameters declared with static
[PR110815]
Parameters declared with `static` are nonnull. We synthesize
an artifical nonnull attribute for such parameters to get the
same warnings and optimizations.
Bootstrapped and regression tested on x86.
PR c/110815
PR c/112428
gcc/c-family:
* c-attribs.cc (build_attr_access_from_parms): Synthesize
nonnull attribute for parameters declared with `static`.
gcc:
* gimple-ssa-warn-access.cc
(pass_waccess::maybe_check_access_sizes):
remove warning for parameters declared with `static`.
gcc/testsuite:
* gcc.dg/Wnonnull-8.c: Adapt test.
* gcc.dg/Wnonnull-9.c: New test.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/112428] Wnonnull outputs wrong type
2023-11-07 20:24 [Bug c/112428] New: Wnonnull outputs wrong type muecker at gwdg dot de
2023-11-11 9:39 ` [Bug c/112428] " cvs-commit at gcc dot gnu.org
@ 2023-11-11 9:41 ` uecker at gcc dot gnu.org
2023-11-11 19:03 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: uecker at gcc dot gnu.org @ 2023-11-11 9:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112428
uecker at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |uecker at gcc dot gnu.org
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
--- Comment #2 from uecker at gcc dot gnu.org ---
Fixed on trunk because the specific incorrect warning version is removed and
replaced by the more generic but correct version using the nonnull attribute.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/112428] Wnonnull outputs wrong type
2023-11-07 20:24 [Bug c/112428] New: Wnonnull outputs wrong type muecker at gwdg dot de
2023-11-11 9:39 ` [Bug c/112428] " cvs-commit at gcc dot gnu.org
2023-11-11 9:41 ` uecker at gcc dot gnu.org
@ 2023-11-11 19:03 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-11 19:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112428
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |14.0
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-11-11 19:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-07 20:24 [Bug c/112428] New: Wnonnull outputs wrong type muecker at gwdg dot de
2023-11-11 9:39 ` [Bug c/112428] " cvs-commit at gcc dot gnu.org
2023-11-11 9:41 ` uecker at gcc dot gnu.org
2023-11-11 19:03 ` pinskia 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).