Summary: | missing warning comparing array address to null | ||
---|---|---|---|
Product: | gcc | Reporter: | Martin Sebor <msebor> |
Component: | c | Assignee: | Martin Sebor <msebor> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | egallager |
Priority: | P3 | Keywords: | diagnostic, patch |
Version: | 12.0 | ||
Target Milestone: | 12.0 | ||
See Also: |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33925 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102555 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102867 |
||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | 10.2.0, 11.2.0, 12.0, 4.5.3, 4.6.4, 4.9.4, 5.5.0, 6.4.0, 7.2.0, 8.3.0, 9.1.0 | Last reconfirmed: | 2021-08-30 00:00:00 |
Description
Martin Sebor
2021-08-27 19:21:37 UTC
The master branch has been updated by Martin Sebor <msebor@gcc.gnu.org>: https://gcc.gnu.org/g:4dc7ce6fb3917958d1a6036d8acf2953b9c1b868 commit r12-4059-g4dc7ce6fb3917958d1a6036d8acf2953b9c1b868 Author: Martin Sebor <msebor@redhat.com> Date: Fri Oct 1 11:50:25 2021 -0600 Enhance -Waddress to detect more suspicious expressions [PR102103]. Resolves: PR c/102103 - missing warning comparing array address to null gcc/ChangeLog: PR c/102103 * doc/invoke.texi (-Waddress): Update. * gengtype.c (write_types): Avoid -Waddress. * poly-int.h (POLY_SET_COEFF): Avoid using null. gcc/c-family/ChangeLog: PR c/102103 * c-common.c (decl_with_nonnull_addr_p): Handle members. Check and perform warning suppression. (c_common_truthvalue_conversion): Enhance warning suppression. gcc/c/ChangeLog: PR c/102103 * c-typeck.c (maybe_warn_for_null_address): New function. (build_binary_op): Call it. gcc/cp/ChangeLog: PR c/102103 * typeck.c (warn_for_null_address): Enhance. (cp_build_binary_op): Call it also for member pointers. gcc/fortran/ChangeLog: PR c/102103 * array.c: Remove an unnecessary test. * trans-array.c: Same. gcc/testsuite/ChangeLog: PR c/102103 * g++.dg/cpp0x/constexpr-array-ptr10.C: Suppress a valid warning. * g++.dg/warn/Wreturn-local-addr-6.C: Correct a cast. * gcc.dg/Waddress.c: Expect a warning. * c-c++-common/Waddress-3.c: New test. * c-c++-common/Waddress-4.c: New test. * g++.dg/warn/Waddress-5.C: New test. * g++.dg/warn/Waddress-6.C: New test. * g++.dg/warn/pr101219.C: Expect a warning. * gcc.dg/Waddress-3.c: New test. Done for GCC 12. This should probably get a note in gcc-12/changes.html IMO |