]> git.ipfire.org Git - thirdparty/gcc.git/commit
c: Synthesize nonnull attribute for parameters declared with static [PR110815]
authorMartin Uecker <uecker@tugraz.at>
Thu, 27 Jul 2023 11:41:33 +0000 (13:41 +0200)
committerMartin Uecker <uecker@tugraz.at>
Sat, 11 Nov 2023 09:37:46 +0000 (10:37 +0100)
commitc58b426d64ac2513dc0ed19165740604e891e9df
treefb0ed672a677d1053af234821420b7460cd61504
parent391f9798b35ec75c1a49fb04610db5ab347e9d0d
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.
gcc/c-family/c-attribs.cc
gcc/gimple-ssa-warn-access.cc
gcc/testsuite/gcc.dg/Wnonnull-8.c
gcc/testsuite/gcc.dg/Wnonnull-9.c [new file with mode: 0644]