This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR70054
- From: Jeff Law <law at redhat dot com>
- To: Richard Biener <rguenther at suse dot de>, gcc-patches at gcc dot gnu dot org
- Date: Fri, 4 Mar 2016 00:28:42 -0700
- Subject: Re: [PATCH] Fix PR70054
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LSU dot 2 dot 11 dot 1603031323380 dot 31547 at t29 dot fhfr dot qr>
On 03/03/2016 05:35 AM, Richard Biener wrote:
The following patch adjusts strict_aliasing_warning to use
proper alias_set_subset_of instead of relying on alias_sets_conflict_p
as after the PR66110 fix aggregates with a char[] member do not
automatically behave like having alias-set zero. As a side-effect
the test will be somewhat stricter as well accessing a 'long' with
a struct { int i; long l; } * will now warn while it previously
didn't:
struct S { int i; long l; };
long x;
struct S foo () { return *(struct S *)&x; }
now warns:
t.c: In function ʽfooʼ:
t.c:3:35: warning: dereferencing type-punned pointer will break
strict-aliasing rules [-Wstrict-aliasing]
struct S foo () { return *(struct S *)&x; }
^
Bootstrap and regtest running on x86_64-unknown-linux-gnu, ok for trunk?
Thanks,
Richard.
2016-03-03 Richard Biener <rguenther@suse.de>
PR c++/70054
* c-common.c (strict_aliasing_warning): Use alias_set_subset_of
instead of alias_sets_conflict_p.
* g++.dg/warn/Wstrict-aliasing-bogus-union-2.C: New testcase.
* gcc.dg/Wstrict-aliasing-struct-member.c: New testcase.
The PR doesn't have a regression marker, but from reading the PR it's
clearly a regression.
OK for the trunk,
Thanks,
Jeff