re PR middle-end/38503 (warnings from -isystem headers strikes back.)

2009-01-27  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/38503
	* cfgexpand.c (expand_gimple_basic_block): Ignore
	GIMPLE_CHANGE_DYNAMIC_TYPE during expansion.
	* tree-ssa-structalias.c (set_uids_in_ptset): Do not prune
	variables that cannot have TBAA applied.
	(compute_points_to_sets): Do not remove GIMPLE_CHANGE_DYNAMIC_TYPE
	statements.

	* g++.dg/warn/Wstrict-aliasing-bogus-placement-new.C: New testcase.

From-SVN: r143700
This commit is contained in:
Richard Guenther 2009-01-27 10:42:59 +00:00 committed by Richard Biener
parent 576de5cb6e
commit b5c3dfbbfb
5 changed files with 49 additions and 15 deletions

View File

@ -1,3 +1,13 @@
2009-01-27 Richard Guenther <rguenther@suse.de>
PR tree-optimization/38503
* cfgexpand.c (expand_gimple_basic_block): Ignore
GIMPLE_CHANGE_DYNAMIC_TYPE during expansion.
* tree-ssa-structalias.c (set_uids_in_ptset): Do not prune
variables that cannot have TBAA applied.
(compute_points_to_sets): Do not remove GIMPLE_CHANGE_DYNAMIC_TYPE
statements.
2009-01-27 Uros Bizjak <ubizjak@gmail.com>
PR middle-end/38969

View File

@ -1970,7 +1970,7 @@ expand_gimple_basic_block (basic_block bb)
return new_bb;
}
}
else
else if (gimple_code (stmt) != GIMPLE_CHANGE_DYNAMIC_TYPE)
{
tree stmt_tree = gimple_to_tree (stmt);
last = get_last_insn ();

View File

@ -1,3 +1,8 @@
2009-01-27 Richard Guenther <rguenther@suse.de>
PR tree-optimization/38503
* g++.dg/warn/Wstrict-aliasing-bogus-placement-new.C: New testcase.
2009-01-27 Uros Bizjak <ubizjak@gmail.com>
PR middle-end/38969

View File

@ -0,0 +1,29 @@
/* { dg-do compile } */
/* { dg-options "-O2 -Wstrict-aliasing" } */
inline void *operator new (__SIZE_TYPE__, void *__p) throw() { return __p; }
struct Y {
Y() {}
int i;
};
struct X {
X() {}
void construct(const Y& y)
{
new (&m_data[0]) Y(y);
}
bool initialized;
char m_data[sizeof (Y)];
};
void bar(const X&);
void foo(Y& y)
{
X x;
x.construct(y);
x.initialized = true;
bar(x);
}

View File

@ -4703,7 +4703,8 @@ set_uids_in_ptset (tree ptr, bitmap into, bitmap from, bool is_derefed,
type-based pruning disabled. */
if (vi->is_artificial_var
|| !is_derefed
|| no_tbaa_pruning)
|| no_tbaa_pruning
|| vi->no_tbaa_pruning)
bitmap_set_bit (into, DECL_UID (vi->decl));
else
{
@ -5496,19 +5497,8 @@ compute_points_to_sets (void)
find_func_aliases (phi);
}
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
{
gimple stmt = gsi_stmt (gsi);
find_func_aliases (stmt);
/* The information in GIMPLE_CHANGE_DYNAMIC_TYPE statements
has now been captured, and we can remove them. */
if (gimple_code (stmt) == GIMPLE_CHANGE_DYNAMIC_TYPE)
gsi_remove (&gsi, true);
else
gsi_next (&gsi);
}
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
find_func_aliases (gsi_stmt (gsi));
}