Commit e9a35493 by Richard Biener Committed by Richard Biener

re PR middle-end/70054 (GCC 6 gives a strict-aliasing warning on use of std::aligned_storage)

2016-03-04  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.

From-SVN: r233961
parent 6a27431a
2016-03-04 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.
2016-03-01 Marek Polacek <polacek@redhat.com>
PR c++/69795
......
......@@ -1568,7 +1568,7 @@ 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_sets_conflict_p (set1, set2)))
&& (set1 == 0 || !alias_set_subset_of (set2, set1)))
{
warning (OPT_Wstrict_aliasing, "dereferencing type-punned "
"pointer will break strict-aliasing rules");
......
2016-03-04 Richard Biener <rguenther@suse.de>
PR c++/70054
* g++.dg/warn/Wstrict-aliasing-bogus-union-2.C: New testcase.
* gcc.dg/Wstrict-aliasing-struct-member.c: New testcase.
2016-03-04 Dominik Vogt <vogt@linux.vnet.ibm.com>
PR testsuite/69766
......
/* { dg-do compile { target c++11 } } */
/* { dg-options "-Wstrict-aliasing=2 -O2 -Wall" } */
#include <type_traits>
struct foo
{
std::aligned_storage<sizeof(long), alignof(long)>::type raw;
long& cooked()
{
return *static_cast<long*>(static_cast<void*>(&raw)); /* { dg-bogus "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" } */
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