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  <rguent...@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

Reply via email to