From 6dc93b16c6f32fab8452601f262bf57db253ef65 Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Wed, 13 Jan 2010 16:37:37 +0100 Subject: re PR tree-optimization/42703 (ICE in generate_subtree_copies with out of bounds array access) 2010-01-13 Martin Jambor 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 --- gcc/tree-sra.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'gcc/tree-sra.c') 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)) { -- cgit v1.1