]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fix use of COMPLETE_TYPE_P for -Wstrict-aliasing=1
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Apr 2019 10:33:10 +0000 (10:33 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Apr 2019 10:33:10 +0000 (10:33 +0000)
commit8bbdcaf0f180c97d4bdb7f873a341ae85cfbecd1
treed4f07be6bc47beccfe2a18adf7c4fd4762e2865a
parentd01c8f9b65f991b3f8646e4f14917c5cdf652c11
Fix use of COMPLETE_TYPE_P for -Wstrict-aliasing=1

The handling of -Wstrict-aliasing=1 applied COMPLETE_TYPE_P to the
pointer type rather than the pointer target, so missed the warnings
for "struct incomplete" in the testcase.

I couldn't find any existing C tests for -Wstrict-aliasing=1,
so I added a few extra tests besides the ones fixed by the patch.
I'm sure there's lots more we could test -- this is just supposed
to be better than the status quo (i.e. nothing).

2019-04-26  Richard Sandiford  <richard.sandiford@arm.com>

gcc/c-family/
* c-warn.c (strict_aliasing_warning): Apply COMPLETE_TYPE_P to
the pointer target rather than the pointer itself.

gcc/testsuite/
* gcc.dg/alias-16.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@270594 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/c-family/ChangeLog
gcc/c-family/c-warn.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/alias-16.c [new file with mode: 0644]