summaryrefslogtreecommitdiff
path: root/gcc/tree-sra.c
diff options
context:
space:
mode:
authorjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2010-01-13 15:37:37 +0000
committerjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2010-01-13 15:37:37 +0000
commit471403d4c6661b1c1cf5b5f2e226604b645e7c7b (patch)
tree1f033dfe8941e8c89c0ac78c93049266d6af94af /gcc/tree-sra.c
parenteb4bdd4ddcc8a874a33304dcafdc2863dc3a3115 (diff)
downloadgcc-471403d4c6661b1c1cf5b5f2e226604b645e7c7b.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155863 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-sra.c')
-rw-r--r--gcc/tree-sra.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index ebb40c4aa1a..38b3cf507e0 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))
{