diff options
author | Alexandre Oliva <oliva@adacore.com> | 2023-11-20 05:14:31 -0300 |
---|---|---|
committer | Alexandre Oliva <oliva@gnu.org> | 2023-11-20 05:14:31 -0300 |
commit | 0e0e3420dfe1d302145b4eb3bbf311a4f39eeced (patch) | |
tree | 919450add85a42f3dab122b5732589cc68957e17 /gcc/tree-cfg.cc | |
parent | 69741355e6dbcf64408b77dca6a2f863ccecdae9 (diff) | |
download | gcc-0e0e3420dfe1d302145b4eb3bbf311a4f39eeced.zip gcc-0e0e3420dfe1d302145b4eb3bbf311a4f39eeced.tar.gz gcc-0e0e3420dfe1d302145b4eb3bbf311a4f39eeced.tar.bz2 |
testsuite: analyzer: expect alignment warning with -fshort-enums
On targets that have -fshort-enums enabled by default, the type casts
in the pr108251 analyzer tests warn that the byte-aligned enums may
not be sufficiently aligned to be a struct connection *. The function
can't know better, the warning is reasonable, the code doesn't
expected enums to be shorter and less aligned than the struct.
Rather than use -fno-short-enums, I decided to embrace the warning on
targets that have short_enums enabled by default.
However, C++ doesn't issue the warning, because even with
-fshort-enums, enumeration types are not TYPE_PACKED, and the
expression is not sufficiently simplified by the C++ front-end for
check_and_warn_address_or_pointer_of_packed_member to identify the
insufficiently aligned pointer. So don't expect the warning there.
for gcc/testsuite/ChangeLog
* c-c++-common/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early-O2.c:
Expect "unaligned pointer value" warning on short_enums
targets, but not in c++.
* c-c++-common/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c:
Likewise.
Diffstat (limited to 'gcc/tree-cfg.cc')
0 files changed, 0 insertions, 0 deletions