summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-08-18 08:40:32 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-08-18 08:40:32 +0000
commit400196f17b3ba17b1a6be96f6ec3c5aa1fec71fc (patch)
tree24ff58adc68f2b06c8eb78be461d5f77f191a2f0
parent46102bbfb97c6fdd82c44cea42e3a1e7c91ab99b (diff)
downloadgcc-400196f17b3ba17b1a6be96f6ec3c5aa1fec71fc.tar.gz
tree-sra.c (generate_element_init_1): Deal with NULL constructor element index.
2008-08-18 Richard Guenther <rguenther@suse.de> * tree-sra.c (generate_element_init_1): Deal with NULL constructor element index. (scalarize_init): If we failed to generate some initializers do not generate zeros for not instantiated members. Instead rely on the copy out. * tree-ssa-operands.c (get_addr_dereference_operands): Warn about missing flow-sensitive alias info only if we have aliases computed. From-SVN: r139188
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/tree-sra.c18
-rw-r--r--gcc/tree-ssa-operands.c3
3 files changed, 26 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4d5c6b4d449..0f42ce4159d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2008-08-18 Richard Guenther <rguenther@suse.de>
+
+ * tree-sra.c (generate_element_init_1): Deal with NULL constructor
+ element index.
+ (scalarize_init): If we failed to generate some initializers
+ do not generate zeros for not instantiated members. Instead
+ rely on the copy out.
+ * tree-ssa-operands.c (get_addr_dereference_operands): Warn
+ about missing flow-sensitive alias info only if we have
+ aliases computed.
+
2008-08-17 Nick Clifton <nickc@redhat.com>
* doc/extend.texi (Function Attributes): Fix typo in description
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 5ae1c51350c..85217ece07a 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -2779,6 +2779,12 @@ generate_element_init_1 (struct sra_elt *elt, tree init, gimple_seq *seq_p)
case CONSTRUCTOR:
FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (init), idx, purpose, value)
{
+ /* Array constructors are routinely created with NULL indices. */
+ if (purpose == NULL_TREE)
+ {
+ result = false;
+ break;
+ }
if (TREE_CODE (purpose) == RANGE_EXPR)
{
tree lower = TREE_OPERAND (purpose, 0);
@@ -3404,11 +3410,6 @@ scalarize_init (struct sra_elt *lhs_elt, tree rhs, gimple_stmt_iterator *gsi)
result = generate_element_init (lhs_elt, rhs, &init_seq);
}
- /* CONSTRUCTOR is defined such that any member not mentioned is assigned
- a zero value. Initialize the rest of the instantiated elements. */
- generate_element_zero (lhs_elt, &seq);
- gimple_seq_add_seq (&seq, init_seq);
-
if (!result)
{
/* If we failed to convert the entire initializer, then we must
@@ -3423,6 +3424,13 @@ scalarize_init (struct sra_elt *lhs_elt, tree rhs, gimple_stmt_iterator *gsi)
gimple_seq_add_seq (&seq0, seq);
seq = seq0;
}
+ else
+ {
+ /* CONSTRUCTOR is defined such that any member not mentioned is assigned
+ a zero value. Initialize the rest of the instantiated elements. */
+ generate_element_zero (lhs_elt, &seq);
+ gimple_seq_add_seq (&seq, init_seq);
+ }
if (lhs_elt->use_block_copy || !result)
{
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c
index 304df53863e..8c94baa5c66 100644
--- a/gcc/tree-ssa-operands.c
+++ b/gcc/tree-ssa-operands.c
@@ -1504,7 +1504,8 @@ get_addr_dereference_operands (gimple stmt, tree *addr, int flags,
&& TREE_CODE (ptr) == SSA_NAME
&& (pi == NULL
|| (pi->name_mem_tag == NULL_TREE
- && !pi->pt_anything)))
+ && !pi->pt_anything))
+ && gimple_aliases_computed_p (cfun))
{
fprintf (dump_file,
"NOTE: no flow-sensitive alias info for ");