On February 19, 2016 5:21:56 PM GMT+01:00, Martin Jambor <mjam...@suse.cz> wrote: >Hi, > >in PR 69666, SRA attempts to turn a load from an aggregate that is >uninitialized into a load from a default definition SSA name (which >something it does to generate an appropriate warning later) but >unfortunately it does so using an access structure which is >representable with __int128 when the load in question is smaller. It >then attempts to fix it up only to create an invalid V_C_E. In this >case, the correct thing to do is not to attempt the transformation, >when there are smaller accesses, which can be figured out by looking >at the unscalarizable_region flag of the access. > >Bootstrapped and tested on x86_64, OK for trunk and later for the 5 >branch?
OK. Richard. >Thanks, > >Martin > > >2016-02-19 Martin Jambor <mjam...@suse.cz> > > PR tree-optimization/69666 > * tree-sra.c (sra_modify_assign): Do not attempt to create > defaut_def replacements for unscalarizable regions. > >testsuite/ > * gcc.dg/tree-ssa/pr69666.c: New test. >--- > gcc/testsuite/gcc.dg/tree-ssa/pr69666.c | 16 ++++++++++++++++ > gcc/tree-sra.c | 1 + > 2 files changed, 17 insertions(+) > create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr69666.c > >diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr69666.c >b/gcc/testsuite/gcc.dg/tree-ssa/pr69666.c >new file mode 100644 >index 0000000..9be77ea >--- /dev/null >+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr69666.c >@@ -0,0 +1,16 @@ >+/* { dg-do compile } */ >+/* { dg-options "-O2 -w" } */ >+ >+int a, c, d; >+float b; >+void *memcpy(); >+int fun1(int p1, unsigned char *p2) { >+ p2[p1] = b; >+ return a; >+} >+void fun2() { >+ unsigned char e[16]; >+ fun1(16, e); >+ d = e[d]; >+ memcpy(&c, e, sizeof(e)); >+} >diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c >index 72157ed..663ded2 100644 >--- a/gcc/tree-sra.c >+++ b/gcc/tree-sra.c >@@ -3339,6 +3339,7 @@ sra_modify_assign (gimple *stmt, >gimple_stmt_iterator *gsi) > } > else if (racc > && !racc->grp_unscalarized_data >+ && !racc->grp_unscalarizable_region > && TREE_CODE (lhs) == SSA_NAME > && !access_has_replacements_p (racc)) > {