aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2010-01-13 16:37:37 +0100
committerMartin Jambor <jamborm@gcc.gnu.org>2010-01-13 16:37:37 +0100
commit6dc93b16c6f32fab8452601f262bf57db253ef65 (patch)
tree1f033dfe8941e8c89c0ac78c93049266d6af94af /gcc
parent1d21a8e566372a8b6344351f5cef1faa4d468250 (diff)
downloadgcc-6dc93b16c6f32fab8452601f262bf57db253ef65.zip
gcc-6dc93b16c6f32fab8452601f262bf57db253ef65.tar.gz
gcc-6dc93b16c6f32fab8452601f262bf57db253ef65.tar.bz2
re PR tree-optimization/42703 (ICE in generate_subtree_copies with out of bounds array access)
2010-01-13 Martin Jambor <mjambor@suse.cz> PR tree-optimization/42703 * tree-sra.c (analyze_access_subtree): Check that we can build a reference to the original data within the aggregate. * testsuite/gcc.c-torture/compile/pr42703.c: New test. From-SVN: r155863
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr42703.c12
-rw-r--r--gcc/tree-sra.c8
4 files changed, 30 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d910562..b8a4ec0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2010-01-13 Martin Jambor <mjambor@suse.cz>
+
+ PR tree-optimization/42703
+ * tree-sra.c (analyze_access_subtree): Check that we can build a
+ reference to the original data within the aggregate.
+
2010-01-13 Richard Guenther <rguenther@suse.de>
PR tree-optimization/42705
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9f3ff54..148ba87 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-01-13 Martin Jambor <mjambor@suse.cz>
+
+ PR tree-optimization/42703
+ * testsuite/gcc.c-torture/compile/pr42703.c: New test.
+
2010-01-13 Richard Guenther <rguenther@suse.de>
PR tree-optimization/42705
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42703.c b/gcc/testsuite/gcc.c-torture/compile/pr42703.c
new file mode 100644
index 0000000..4805b17
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr42703.c
@@ -0,0 +1,12 @@
+__extension__ typedef unsigned long long int uint64_t;
+typedef uint64_t ScmUInt64;
+void swapb64(ScmUInt64 *loc)
+{
+ union {
+ ScmUInt64 l;
+ unsigned char c[4];
+ } dd;
+ unsigned char t;
+ dd.l = *loc;
+ (t = dd.c[3], dd.c[3] = dd.c[4], dd.c[4] = t);
+}
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index ebb40c4..38b3cf5 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -1659,7 +1659,13 @@ analyze_access_subtree (struct access *root, bool allow_replacements,
if (allow_replacements && scalar && !root->first_child
&& (root->grp_hint
- || (direct_read && root->grp_write)))
+ || (direct_read && root->grp_write))
+ /* We must not ICE later on when trying to build an access to the
+ original data within the aggregate even when it is impossible to do in
+ a defined way like in the PR 42703 testcase. Therefore we check
+ pre-emptively here that we will be able to do that. */
+ && build_ref_for_offset (NULL, TREE_TYPE (root->base), root->offset,
+ root->type, false))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{