re PR tree-optimization/40081 (verify_stmts failed with -O2)

2009-05-10  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/40081
	* tree-sra.c (instantiate_element): Instantiate scalar replacements
	using the main variant of the element type.  Do not fiddle with
	TREE_THIS_VOLATILE or TREE_SIDE_EFFECTS.

	* g++.dg/torture/pr40081.C: New testcase.

From-SVN: r147330
This commit is contained in:
Richard Guenther 2009-05-10 10:16:01 +00:00 committed by Richard Biener
parent eb74e79b1b
commit 896d7dbd74
4 changed files with 32 additions and 8 deletions

View file

@ -1,3 +1,10 @@
2009-05-10 Richard Guenther <rguenther@suse.de>
PR tree-optimization/40081
* tree-sra.c (instantiate_element): Instantiate scalar replacements
using the main variant of the element type. Do not fiddle with
TREE_THIS_VOLATILE or TREE_SIDE_EFFECTS.
2009-05-09 Jan Hubicka <jh@suse.cz>
PR middle-end/40080

View file

@ -1,3 +1,8 @@
2009-05-10 Richard Guenther <rguenther@suse.de>
PR tree-optimization/40081
* g++.dg/torture/pr40081.C: New testcase.
2009-05-10 Paul Thomas <pault@gcc.gnu.org>
PR fortran/38863

View file

@ -0,0 +1,16 @@
struct Atomic_t {
Atomic_t(int i) : val(i) { }
volatile int val;
};
class RefCount {
public:
RefCount(Atomic_t c) : m_count(c) { }
Atomic_t m_count;
};
class IntrusiveCountableBase {
RefCount m_useCount;
protected:
IntrusiveCountableBase();
};
IntrusiveCountableBase::IntrusiveCountableBase() : m_useCount(0) { }

View file

@ -1277,7 +1277,8 @@ instantiate_element (struct sra_elt *elt)
nowarn = TREE_NO_WARNING (base_elt->parent->element);
base = base_elt->element;
elt->replacement = var = make_rename_temp (elt->type, "SR");
elt->replacement = var = make_rename_temp (TYPE_MAIN_VARIANT (elt->type),
"SR");
if (DECL_P (elt->element)
&& !tree_int_cst_equal (DECL_SIZE (var), DECL_SIZE (elt->element)))
@ -1286,7 +1287,8 @@ instantiate_element (struct sra_elt *elt)
DECL_SIZE_UNIT (var) = DECL_SIZE_UNIT (elt->element);
elt->in_bitfld_block = 1;
elt->replacement = fold_build3 (BIT_FIELD_REF, elt->type, var,
elt->replacement = fold_build3 (BIT_FIELD_REF,
TYPE_MAIN_VARIANT (elt->type), var,
DECL_SIZE (var),
BYTES_BIG_ENDIAN
? size_binop (MINUS_EXPR,
@ -1303,12 +1305,6 @@ instantiate_element (struct sra_elt *elt)
DECL_SOURCE_LOCATION (var) = DECL_SOURCE_LOCATION (base);
DECL_ARTIFICIAL (var) = 1;
if (TREE_THIS_VOLATILE (elt->type))
{
TREE_THIS_VOLATILE (var) = 1;
TREE_SIDE_EFFECTS (var) = 1;
}
if (DECL_NAME (base) && !DECL_IGNORED_P (base))
{
char *pretty_name = build_element_name (elt);