From: Richard Biener Date: Mon, 29 Oct 2018 15:43:08 +0000 (+0000) Subject: re PR tree-optimization/87785 (ICE in dr_misalignment, at tree-vectorizer.h:1245... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=266ef3613ea80da937a9fc782eb5c3ae8dcabb8f;p=gcc.git re PR tree-optimization/87785 (ICE in dr_misalignment, at tree-vectorizer.h:1245 on 454.calculix with -Ofast and -flto) 2018-10-29 Richard Biener PR tree-optimization/87785 * tree-vect-slp.c (vect_gather_slp_loads): Only gather internal defs. * gcc.dg/torture/20181029-1.c: New testcase. * gcc.dg/torture/20181029-2.c: Likewise. From-SVN: r265596 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 735bb897a99..fec9ddf3e49 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-10-29 Richard Biener + + PR tree-optimization/87785 + * tree-vect-slp.c (vect_gather_slp_loads): Only gather + internal defs. + 2018-10-29 Olivier Hainque * VXWORKS_NET_LIBS_RTP: New macro, network part of VXWORKS_LIBS_RTP. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fa6d53717ab..6cc3e1bb86a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2018-10-29 Richard Biener + + PR tree-optimization/87785 + * gcc.dg/torture/20181029-1.c: New testcase. + * gcc.dg/torture/20181029-2.c: Likewise. + 2018-10-29 Richard Biener PR tree-optimization/87790 diff --git a/gcc/testsuite/gcc.dg/torture/20181029-1.c b/gcc/testsuite/gcc.dg/torture/20181029-1.c new file mode 100644 index 00000000000..6576719015e --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/20181029-1.c @@ -0,0 +1,81 @@ +/* { dg-do compile } */ + +typedef __SIZE_TYPE__ size_t; +typedef unsigned long UV; +typedef size_t STRLEN; +typedef struct sv SV; +typedef struct magic MAGIC; +typedef struct xpv XPV; +typedef unsigned char U8; +typedef int I32; +typedef unsigned int U32; +struct sv { + void* sv_any; + U32 sv_flags; +}; +struct xpv { + char * xpv_pv; + STRLEN xpv_cur; +}; +struct magic { + char* mg_ptr; +}; +extern const unsigned char PL_utf8skip[]; +char *Perl_sv_2pv_flags (STRLEN *); +void Perl_utf8n_to_uvuni (U8 *); +void Perl_sv_magic (SV *); +void Perl_sv_pos_b2u( register SV* sv, I32* offsetp, MAGIC *mg) +{ + U8* s; + STRLEN len; + s = (U8*)(((sv)->sv_flags & (0x00040000)) == 0x00040000 + ? ((len = ((XPV*) (sv)->sv_any)->xpv_cur), ((XPV*) (sv)->sv_any)->xpv_pv) + : Perl_sv_2pv_flags(&len)); + if ((I32)len < *offsetp) + ; + else + { + STRLEN *cache = ((void *)0); + if (((sv)->sv_flags & (0x00002000|0x00004000|0x00008000)) + && !((sv)->sv_flags & 0x00800000)) + { + if (mg && mg->mg_ptr) + { + cache = (STRLEN *) mg->mg_ptr; + STRLEN forw = *offsetp; + STRLEN backw = cache[1] - *offsetp; + if (!(forw < 2 * backw)) + { + U8 *p = s + cache[1]; + STRLEN ubackw = 0; + cache[1] -= backw; + while (backw--) + { + p--; + while ((((U8)*p) >= 0x80 && (((U8)*p) <= 0xbf))) + { + p--; + backw--; + } + ubackw++; + } + cache[0] -= ubackw; + *offsetp = cache[0]; + cache[2] = 0; + cache[3] = 0; + return; + } + } + if (!(((UV)(*s)) < 0x80)) + Perl_utf8n_to_uvuni(s); + } + if (!((sv)->sv_flags & 0x00800000)) + { + if (!mg) + Perl_sv_magic(sv); + cache[0] = len; + cache[1] = *offsetp; + } + *offsetp = len; + } +} diff --git a/gcc/testsuite/gcc.dg/torture/20181029-2.c b/gcc/testsuite/gcc.dg/torture/20181029-2.c new file mode 100644 index 00000000000..65a36564b2b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/20181029-2.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ + +int a, b; +unsigned long c; +unsigned long *d; +void e(); +void f() +{ + if (c) + { + if (a) + { + e(); + d[0] = c; + d[1] = b; + } + b = c; + } +} diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index a1db0dfde86..6ec7358c2dc 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -1645,7 +1645,8 @@ vect_gather_slp_loads (slp_instance inst, slp_tree node, if (SLP_TREE_CHILDREN (node).length () == 0) { stmt_vec_info stmt_info = SLP_TREE_SCALAR_STMTS (node)[0]; - if (STMT_VINFO_GROUPED_ACCESS (stmt_info) + if (SLP_TREE_DEF_TYPE (node) == vect_internal_def + && STMT_VINFO_GROUPED_ACCESS (stmt_info) && DR_IS_READ (STMT_VINFO_DATA_REF (stmt_info))) SLP_INSTANCE_LOADS (inst).safe_push (node); }