Commit c06d25bb by Richard Biener Committed by Richard Biener

re PR c/70143 (false strict-aliasing warning)

2016-03-09  Richard Biener  <rguenther@suse.de>

	c-family/
	PR c/70143
	* c-common.c (strict_aliasing_warning): Add back
	alias_sets_conflict_p check.

	* gcc.dg/Wstrict-aliasing-bogus-upcast.c: New testcase.
	* gcc.dg/Wstrict-aliasing-struct-with-char-member.c: Likewise.
	* gcc.dg/Wstrict-aliasing-struct-member.c: Remove again.

From-SVN: r234084
parent 8e80c4d4
2016-03-09 Richard Biener <rguenther@suse.de>
PR c/70143
* c-common.c (strict_aliasing_warning): Add back
alias_sets_conflict_p check.
2016-03-08 Jason Merrill <jason@redhat.com>
* c-opts.c (set_std_cxx1z): Don't enable concepts.
......
......@@ -1568,7 +1568,9 @@ strict_aliasing_warning (tree otype, tree type, tree expr)
alias_set_type set2 = get_alias_set (TREE_TYPE (type));
if (set1 != set2 && set2 != 0
&& (set1 == 0 || !alias_set_subset_of (set2, set1)))
&& (set1 == 0
|| (!alias_set_subset_of (set2, set1)
&& !alias_sets_conflict_p (set1, set2))))
{
warning (OPT_Wstrict_aliasing, "dereferencing type-punned "
"pointer will break strict-aliasing rules");
......
2016-03-09 Richard Biener <rguenther@suse.de>
PR c/70143
* gcc.dg/Wstrict-aliasing-bogus-upcast.c: New testcase.
* gcc.dg/Wstrict-aliasing-struct-with-char-member.c: Likewise.
* gcc.dg/Wstrict-aliasing-struct-member.c: Remove again.
2016-03-09 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* gcc.dg/vect/bb-slp-34.c: Really don't xfail on aarch64-*-*,
......
/* { dg-do compile } */
/* { dg-options "-O2 -Wall" } */
struct a {
int i;
};
struct b {
struct a a;
int j;
};
int main(void)
{
static struct b b;
struct a *ap=(struct a *)&b;
return ((struct b *)&ap->i)->j; /* { dg-bogus "will break strict-aliasing" } */
}
/* { dg-do compile } */
/* { dg-options "-O2 -Wall" } */
struct S { int i; long l; };
long x;
struct S foo () { return *(struct S *)&x; } /* { dg-warning "will break strict-aliasing" } */
/* { dg-do compile } */
/* { dg-options "-O2 -Wall" } */
struct a {
int i;
char c;
};
struct b {
float f;
float g;
};
int main(void)
{
static struct b b;
return ((struct a *)&b)->i; /* { dg-warning "will break strict-aliasing" } */
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment