public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/95570] New: ICE: Segmentation fault in vect_loop_versioning
@ 2020-06-08  6:45 felix.yang at huawei dot com
  2020-06-09  6:54 ` [Bug tree-optimization/95570] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: felix.yang at huawei dot com @ 2020-06-08  6:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95570

            Bug ID: 95570
           Summary: ICE: Segmentation fault in vect_loop_versioning
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: felix.yang at huawei dot com
  Target Milestone: ---
            Target: aarch64

foo.c:
int x[8][32];

void
foo (int start)
{
  for (int i = start; i < start + 16; i++)
    x[start][i] = i;
}

$ gcc -S -O2 -ftree-loop-vectorize -march=armv8.2-a+sve -msve-vector-bits=256
-fno-vect-cost-model -fwrapv -mstrict-align foo.c
during GIMPLE pass: vect
foo.c: In function ‘foo’:
foo.c:4:1: internal compiler error: Segmentation fault
    4 | foo (int start)
      | ^~~
0x12bb79b crash_signal
        ../../gcc-git/gcc/toplev.c:328
0x94cc4c contains_struct_check(tree_node const*, tree_node_structure_enum, char
const*, int, char const*)
        ../../gcc-git/gcc/tree.h:3665
0x9893db wi::extended_tree<576>::extended_tree(tree_node const*)
        ../../gcc-git/gcc/tree.h:5922
0x987e9b generic_wide_int<wi::extended_tree<576> >::generic_wide_int<tree_node
const*>(tree_node const* const&)
        ../../gcc-git/gcc/wide-int.h:782
0x98796f wi::to_widest(tree_node const*)
        ../../gcc-git/gcc/tree.h:5849
0xa84e13 tree_int_cst_compare(tree_node const*, tree_node const*)
        ../../gcc-git/gcc/tree.h:6121
0x16911bb vect_create_cond_for_align_checks
        ../../gcc-git/gcc/tree-vect-loop-manip.c:3055
0x1691a1f vect_loop_versioning(_loop_vec_info*, gimple*)
        ../../gcc-git/gcc/tree-vect-loop-manip.c:3263
0x167ffbb vect_transform_loop(_loop_vec_info*, gimple*)
        ../../gcc-git/gcc/tree-vect-loop.c:8691
0x16ac56b try_vectorize_loop_1
        ../../gcc-git/gcc/tree-vectorizer.c:989
0x16ac7e7 try_vectorize_loop
        ../../gcc-git/gcc/tree-vectorizer.c:1046
0x16ac997 vectorize_loops()
        ../../gcc-git/gcc/tree-vectorizer.c:1125
0x1507e2b execute
        ../../gcc-git/gcc/tree-ssa-loop.c:414

Here, we are doing loop versionging for alignment.
The only dr here is a gather-statter operation: x[start][i].
Scalar evolution analysis for this dr failed, so DR_STEP is NULL_TREE, which
leads to the segfault.
But scatter-gather operation should be filtered out in
vect_enhance_data_refs_alignment.
Like:
@@ -2206,6 +2228,12 @@ vect_enhance_data_refs_alignment (loop_vec_info
loop_vinfo)
                  && DR_GROUP_FIRST_ELEMENT (stmt_info) != stmt_info))
            continue;

+         /* For scatter-gather or invariant accesses there is nothing
+            to enhance.  */
+         if (STMT_VINFO_GATHER_SCATTER_P (stmt_info)
+           || integer_zerop (DR_STEP (dr)))
+           continue;
+
          if (STMT_VINFO_STRIDED_P (stmt_info))
            {
              /* Strided loads perform only component accesses, alignment is

I also witnessed similar issues in vect_verify_datarefs_alignment,
vect_get_peeling_costs_all_drs and vect_peeling_supportable. Since the code is
similar, maybe we should propose a new funtion for that.  Suggestions?

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-06-12 11:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-08  6:45 [Bug tree-optimization/95570] New: ICE: Segmentation fault in vect_loop_versioning felix.yang at huawei dot com
2020-06-09  6:54 ` [Bug tree-optimization/95570] " rguenth at gcc dot gnu.org
2020-06-09 11:26 ` marxin at gcc dot gnu.org
2020-06-12 10:38 ` [Bug tree-optimization/95570] vect: " cvs-commit at gcc dot gnu.org
2020-06-12 11:19 ` rsandifo at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).