aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2009-09-07 19:08:12 +0200
committerMartin Jambor <jamborm@gcc.gnu.org>2009-09-07 19:08:12 +0200
commit4a50e99c6531d1d413e75f19c802ba5fd6ab103a (patch)
tree0fe789e9c973b1097403272d2569032c96f3d0e9
parente5b258a4c95ee45aae8fb7ec9f7ba81dc68addc2 (diff)
downloadgcc-4a50e99c6531d1d413e75f19c802ba5fd6ab103a.zip
gcc-4a50e99c6531d1d413e75f19c802ba5fd6ab103a.tar.gz
gcc-4a50e99c6531d1d413e75f19c802ba5fd6ab103a.tar.bz2
re PR middle-end/41282 (Revision 151394 failed to compile mplayer)
2009-09-07 Martin Jambor <mjambor@suse.cz> PR middle-end/41282 * tree-sra.c (create_artificial_child_access): Return NULL if build_ref_for_offset fails. (propagate_subacesses_accross_link): Allow build_ref_for_offset and create_artificial_child_access to fail. * testsuite/gcc.c-torture/compile/pr41282.c: New test. From-SVN: r151484
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr41282.c20
-rw-r--r--gcc/tree-sra.c42
4 files changed, 56 insertions, 19 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7ad76cc..5329be5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2009-09-07 Martin Jambor <mjambor@suse.cz>
+
+ PR middle-end/41282
+ * tree-sra.c (create_artificial_child_access): Return NULL if
+ build_ref_for_offset fails.
+ (propagate_subacesses_accross_link): Allow build_ref_for_offset
+ and create_artificial_child_access to fail.
+
2009-09-06 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
PR c++/41214
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 41a9089..166d03d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-09-07 Martin Jambor <mjambor@suse.cz>
+
+ PR middle-end/41282
+ * gcc.c-torture/compile/pr41282.c: New test.
+
2009-09-07 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/41197
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41282.c b/gcc/testsuite/gcc.c-torture/compile/pr41282.c
new file mode 100644
index 0000000..3a0f02d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr41282.c
@@ -0,0 +1,20 @@
+struct S
+{
+ unsigned int iu;
+};
+
+union U
+{
+ struct S s;
+ signed int is;
+};
+
+extern signed int bar ();
+
+struct S foo (void)
+{
+ union U u;
+
+ u.is = bar ();
+ return u.s;
+}
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index a801839..431c456 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -1518,9 +1518,9 @@ child_would_conflict_in_lacc (struct access *lacc, HOST_WIDE_INT norm_offset,
/* Create a new child access of PARENT, with all properties just like MODEL
except for its offset and with its grp_write false and grp_read true.
- Return the new access. Note that this access is created long after all
- splicing and sorting, it's not located in any access vector and is
- automatically a representative of its group. */
+ Return the new access or NULL if it cannot be created. Note that this access
+ is created long after all splicing and sorting, it's not located in any
+ access vector and is automatically a representative of its group. */
static struct access *
create_artificial_child_access (struct access *parent, struct access *model,
@@ -1528,22 +1528,23 @@ create_artificial_child_access (struct access *parent, struct access *model,
{
struct access *access;
struct access **child;
- bool ok;
+ tree expr = parent->base;;
gcc_assert (!model->grp_unscalarizable_region);
+ if (!build_ref_for_offset (&expr, TREE_TYPE (expr), new_offset,
+ model->type, false))
+ return NULL;
+
access = (struct access *) pool_alloc (access_pool);
memset (access, 0, sizeof (struct access));
access->base = parent->base;
+ access->expr = expr;
access->offset = new_offset;
access->size = model->size;
access->type = model->type;
access->grp_write = true;
access->grp_read = false;
- access->expr = access->base;
- ok = build_ref_for_offset (&access->expr, TREE_TYPE (access->expr),
- new_offset, access->type, false);
- gcc_assert (ok);
child = &parent->first_child;
while (*child && (*child)->offset < new_offset)
@@ -1558,7 +1559,7 @@ create_artificial_child_access (struct access *parent, struct access *model,
/* Propagate all subaccesses of RACC across an assignment link to LACC. Return
true if any new subaccess was created. Additionally, if RACC is a scalar
- access but LACC is not, change the type of the latter. */
+ access but LACC is not, change the type of the latter, if possible. */
static bool
propagate_subacesses_accross_link (struct access *lacc, struct access *racc)
@@ -1575,13 +1576,14 @@ propagate_subacesses_accross_link (struct access *lacc, struct access *racc)
if (!lacc->first_child && !racc->first_child
&& is_gimple_reg_type (racc->type))
{
- bool ok;
+ tree t = lacc->base;
- lacc->expr = lacc->base;
- ok = build_ref_for_offset (&lacc->expr, TREE_TYPE (lacc->expr),
- lacc->offset, racc->type, false);
- gcc_assert (ok);
- lacc->type = racc->type;
+ if (build_ref_for_offset (&t, TREE_TYPE (t), lacc->offset, racc->type,
+ false))
+ {
+ lacc->expr = t;
+ lacc->type = racc->type;
+ }
return false;
}
@@ -1615,10 +1617,12 @@ propagate_subacesses_accross_link (struct access *lacc, struct access *racc)
rchild->grp_hint = 1;
new_acc = create_artificial_child_access (lacc, rchild, norm_offset);
- if (racc->first_child)
- propagate_subacesses_accross_link (new_acc, rchild);
-
- ret = true;
+ if (new_acc)
+ {
+ ret = true;
+ if (racc->first_child)
+ propagate_subacesses_accross_link (new_acc, rchild);
+ }
}
return ret;