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

* [Bug tree-optimization/95570] ICE: Segmentation fault in vect_loop_versioning
  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 ` rguenth at gcc dot gnu.org
  2020-06-09 11:26 ` marxin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-06-09  6:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Just spread the tests.  Actual test coverage for all cases would be nice.

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

* [Bug tree-optimization/95570] ICE: Segmentation fault in vect_loop_versioning
  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
  3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-06-09 11:26 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-06-09
                 CC|                            |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1

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

* [Bug tree-optimization/95570] vect: ICE: Segmentation fault in vect_loop_versioning
  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 ` cvs-commit at gcc dot gnu.org
  2020-06-12 11:19 ` rsandifo at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-12 10:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Sandiford <rsandifo@gcc.gnu.org>:

https://gcc.gnu.org/g:d30846a02eb9ea43b61311e74fbf05692ffefba2

commit r11-1283-gd30846a02eb9ea43b61311e74fbf05692ffefba2
Author: Fei Yang <felix.yang@huawei.com>
Date:   Fri Jun 12 11:37:00 2020 +0100

    vect: Fix an ICE in vect_loop_versioning [PR95570]

    In the test case for PR95570, the only data reference in the loop is a
    gather-statter access.  Scalar evolution analysis for this data reference
    failed, so DR_STEP is NULL_TREE.  This leads to the segmentation fault.
    We should filter out scatter-gather access in
vect_enhance_data_refs_alignment.

    2020-06-12  Felix Yang  <felix.yang@huawei.com>

    gcc/
            PR tree-optimization/95570
            * tree-vect-data-refs.c (vect_relevant_for_alignment_p): New
function.
            (vect_verify_datarefs_alignment): Call it to filter out data
references
            in the loop whose alignment is irrelevant.
            (vect_get_peeling_costs_all_drs): Likewise.
            (vect_peeling_supportable): Likewise.
            (vect_enhance_data_refs_alignment): Likewise.

    gcc/testsuite/

            PR tree-optimization/95570
            * gcc.dg/vect/pr95570.c: New test.

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

* [Bug tree-optimization/95570] vect: ICE: Segmentation fault in vect_loop_versioning
  2020-06-08  6:45 [Bug tree-optimization/95570] New: ICE: Segmentation fault in vect_loop_versioning felix.yang at huawei dot com
                   ` (2 preceding siblings ...)
  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
  3 siblings, 0 replies; 5+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2020-06-12 11:19 UTC (permalink / raw)
  To: gcc-bugs

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

rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
                 CC|                            |rsandifo at gcc dot gnu.org

--- Comment #3 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Fixed.

^ 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).