From: Richard Guenther Date: Sun, 10 May 2009 16:40:55 +0000 (+0000) Subject: re PR tree-optimization/40081 (verify_stmts failed with -O2) X-Git-Tag: releases/gcc-4.5.0~5809 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b7d7a473ab0813c0f52f71248f3c204dfb2451f0;p=thirdparty%2Fgcc.git re PR tree-optimization/40081 (verify_stmts failed with -O2) 2009-05-10 Richard Guenther PR tree-optimization/40081 Revert * 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. * tree-sra.c (sra_type_can_be_decomposed_p): Do not decompose structs with volatile fields. From-SVN: r147349 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 23022ff0c613..6c0177b65554 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2009-05-10 Richard Guenther + + PR tree-optimization/40081 + Revert + * 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. + + * tree-sra.c (sra_type_can_be_decomposed_p): Do not decompose + structs with volatile fields. + 2009-05-10 Jan Hubicka * tree-inline.c (delete_unreachable_blocks_update_callgraph): Declare. diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 037052053197..626a253d1525 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -270,6 +270,10 @@ sra_type_can_be_decomposed_p (tree type) != TYPE_PRECISION (TREE_TYPE (t)))) goto fail; + /* And volatile fields. */ + if (TREE_THIS_VOLATILE (t)) + goto fail; + saw_one_field = true; } @@ -1277,8 +1281,7 @@ instantiate_element (struct sra_elt *elt) nowarn = TREE_NO_WARNING (base_elt->parent->element); base = base_elt->element; - elt->replacement = var = make_rename_temp (TYPE_MAIN_VARIANT (elt->type), - "SR"); + elt->replacement = var = make_rename_temp (elt->type, "SR"); if (DECL_P (elt->element) && !tree_int_cst_equal (DECL_SIZE (var), DECL_SIZE (elt->element))) @@ -1287,8 +1290,7 @@ 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, - TYPE_MAIN_VARIANT (elt->type), var, + elt->replacement = fold_build3 (BIT_FIELD_REF, elt->type, var, DECL_SIZE (var), BYTES_BIG_ENDIAN ? size_binop (MINUS_EXPR, @@ -1305,6 +1307,12 @@ 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);