diff options
Diffstat (limited to 'gcc/tree-sra.c')
-rw-r--r-- | gcc/tree-sra.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 65b5ef59e15..bf1a0f209f6 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -1,7 +1,7 @@ /* Scalar Replacement of Aggregates (SRA) converts some structure references into scalar references, exposing them to the scalar optimizers. - Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by Martin Jambor <mjambor@suse.cz> This file is part of GCC. @@ -1941,7 +1941,8 @@ create_access_replacement (struct access *access) and that get_ref_base_and_extent works properly on the expression. It cannot handle accesses at a non-constant offset though, so just give up in those cases. */ - for (d = debug_expr; !fail && handled_component_p (d); + for (d = debug_expr; + !fail && (handled_component_p (d) || TREE_CODE (d) == MEM_REF); d = TREE_OPERAND (d, 0)) switch (TREE_CODE (d)) { @@ -1959,6 +1960,12 @@ create_access_replacement (struct access *access) && TREE_CODE (TREE_OPERAND (d, 2)) != INTEGER_CST) fail = true; break; + case MEM_REF: + if (TREE_CODE (TREE_OPERAND (d, 0)) != ADDR_EXPR) + fail = true; + else + d = TREE_OPERAND (d, 0); + break; default: break; } |