public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/96920] New: ICE segmentation fault in tree-vectorizer at -O3
@ 2020-09-03 13:26 hj8758558 at gmail dot com
  2020-09-03 14:11 ` [Bug tree-optimization/96920] [10/11 Regression] " rguenth at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: hj8758558 at gmail dot com @ 2020-09-03 13:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96920
           Summary: ICE segmentation fault in tree-vectorizer at -O3
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hj8758558 at gmail dot com
  Target Milestone: ---

Created attachment 49179
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49179&action=edit
Example Fortran source file to trigger ICE in tree-vectorizer.

When I compile the attached code example with gfortran 10.x series at -O3, I
get the following compiler seg fault. The code compiles okay with gfortran 9.1.

The only previous bug report that I found that might be related is:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95539


$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/users/joshua.hykes/opt/gcc/linux-64/gcc-10.2.0/bin/../libexec/gcc/x86_64-pc-linux-gnu/10.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with:
/users/joshua.hykes/opt/gcc/linux-64/gcc-10.2.0-build/../gcc-10.2.0-src/configure
--prefix=/users/joshua.hykes/opt/gcc/linux-64/gcc-10.2.0-build/../gcc-10.2.0/
--enable-languages=c,c++,fortran,go
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.2.0 (GCC)



$ cat ice.f90
             subroutine ice(npoint, nterm, x, g)
             implicit none
             integer    norder
             parameter (norder=10)
             integer j
             integer k
             integer ii
             integer nterm
             integer npoint
             real b(norder)
             real c(norder)
             real d(norder)
             real x(npoint)
             real g(npoint)
             real gg
             real prev
             real prev2
             !
                 j = 1
           100   continue
                 j = j+1
                 if (nterm == j)  then
                    do ii=1,npoint
                       k = nterm
                       gg= d(k)
                       prev= 0.0
                       do k=k-1,1,-1
                          prev2= prev
                          prev= gg
                          gg = d(k)+(x(ii)-b(k))*prev-c(k+1)*prev2
                       enddo
                       g(ii) = gg
                    enddo
                 endif
                 go to 100
             end


$ gfortran -O3 -c ice.f90
during GIMPLE pass: vect
ice.f90:1:0:

    1 |              subroutine ice(npoint, nterm, x, g)
      |
internal compiler error: Segmentation fault
0xbeddaf crash_signal
       
/users/joshua.hykes/opt/gcc/linux-64/gcc-10.2.0-build/../gcc-10.2.0-src/gcc/toplev.c:328
0x2b14706162ef ???
       
/usr/src/debug/glibc-2.17-c758a686/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0xd01227 find_uses_to_rename_use
       
/users/joshua.hykes/opt/gcc/linux-64/gcc-10.2.0-build/../gcc-10.2.0-src/gcc/tree-ssa-loop-manip.c:393
0xd01227 find_uses_to_rename_bb
       
/users/joshua.hykes/opt/gcc/linux-64/gcc-10.2.0-build/../gcc-10.2.0-src/gcc/tree-ssa-loop-manip.c:468
0xd02e57 find_uses_to_rename
       
/users/joshua.hykes/opt/gcc/linux-64/gcc-10.2.0-build/../gcc-10.2.0-src/gcc/tree-ssa-loop-manip.c:500
0xd02e57 rewrite_into_loop_closed_ssa_1(bitmap_head*, unsigned int, int, loop*)
       
/users/joshua.hykes/opt/gcc/linux-64/gcc-10.2.0-build/../gcc-10.2.0-src/gcc/tree-ssa-loop-manip.c:666
0xe17043 vectorize_loops()
       
/users/joshua.hykes/opt/gcc/linux-64/gcc-10.2.0-build/../gcc-10.2.0-src/gcc/tree-vectorizer.c:1197
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug tree-optimization/96920] [10/11 Regression] ICE segmentation fault in tree-vectorizer at -O3
  2020-09-03 13:26 [Bug fortran/96920] New: ICE segmentation fault in tree-vectorizer at -O3 hj8758558 at gmail dot com
@ 2020-09-03 14:11 ` rguenth at gcc dot gnu.org
  2020-09-03 14:12 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-03 14:11 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.3
            Summary|ICE segmentation fault in   |[10/11 Regression] ICE
                   |tree-vectorizer at -O3      |segmentation fault in
                   |                            |tree-vectorizer at -O3
          Component|fortran                     |tree-optimization
             Status|UNCONFIRMED                 |ASSIGNED
      Known to fail|                            |10.2.0, 11.0
      Known to work|                            |9.3.0
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
   Last reconfirmed|                            |2020-09-03
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed, I'll take a look.

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

* [Bug tree-optimization/96920] [10/11 Regression] ICE segmentation fault in tree-vectorizer at -O3
  2020-09-03 13:26 [Bug fortran/96920] New: ICE segmentation fault in tree-vectorizer at -O3 hj8758558 at gmail dot com
  2020-09-03 14:11 ` [Bug tree-optimization/96920] [10/11 Regression] " rguenth at gcc dot gnu.org
@ 2020-09-03 14:12 ` rguenth at gcc dot gnu.org
  2020-09-04  9:52 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-03 14:12 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
So with outer loop vectorization we fail to update an inner PHI backedge value.

(gdb) p debug_gimple_stmt ($2)
vect_prev_57.20_22 = PHI <vect_cst__23(7), (11)>

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

* [Bug tree-optimization/96920] [10/11 Regression] ICE segmentation fault in tree-vectorizer at -O3
  2020-09-03 13:26 [Bug fortran/96920] New: ICE segmentation fault in tree-vectorizer at -O3 hj8758558 at gmail dot com
  2020-09-03 14:11 ` [Bug tree-optimization/96920] [10/11 Regression] " rguenth at gcc dot gnu.org
  2020-09-03 14:12 ` rguenth at gcc dot gnu.org
@ 2020-09-04  9:52 ` rguenth at gcc dot gnu.org
  2020-09-04 12:31 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-04  9:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
It's similar to PR96698 where we had a nested cycle where a cycle PHI was fed
by an induction.  Here we're feeding the cycle PHI by another cycle PHI so the
fancy detection of computing a latch value doesn't work since the def is both
the PHI of a cycle _and_ the latch def (in PR96698 we were safe because the def
was an induction, not clashing with data structures).

I never liked the current code much but now have to think about sth more
reliable
and workable for SLP.

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

* [Bug tree-optimization/96920] [10/11 Regression] ICE segmentation fault in tree-vectorizer at -O3
  2020-09-03 13:26 [Bug fortran/96920] New: ICE segmentation fault in tree-vectorizer at -O3 hj8758558 at gmail dot com
                   ` (2 preceding siblings ...)
  2020-09-04  9:52 ` rguenth at gcc dot gnu.org
@ 2020-09-04 12:31 ` rguenth at gcc dot gnu.org
  2020-09-04 13:43 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-04 12:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Another example:

int a[1024];
int b[2048];

void foo (int x, int y)
{
  for (int i = 0; i < 1024; ++i)
    {
      int tem0 = b[2*i];
      int tem1 = b[2*i+1];
      for (int j = 0; j < 32; ++j)
        {
          int tem = tem0;
          tem0 = tem1;
          tem1 = tem;
          a[i] += tem0;
        }
    }
}

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

* [Bug tree-optimization/96920] [10/11 Regression] ICE segmentation fault in tree-vectorizer at -O3
  2020-09-03 13:26 [Bug fortran/96920] New: ICE segmentation fault in tree-vectorizer at -O3 hj8758558 at gmail dot com
                   ` (3 preceding siblings ...)
  2020-09-04 12:31 ` rguenth at gcc dot gnu.org
@ 2020-09-04 13:43 ` cvs-commit at gcc dot gnu.org
  2020-09-04 13:43 ` [Bug tree-optimization/96920] [10 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-04 13:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:46a58c779af3055a4b10b285a1f4be28abe4351c

commit r11-3013-g46a58c779af3055a4b10b285a1f4be28abe4351c
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Sep 4 14:35:39 2020 +0200

    tree-optimization/96920 - another ICE when vectorizing nested cycles

    This refines the previous fix for PR96698 by re-doing how and where
    we arrange for setting vectorized cycle PHI backedge values.

    2020-09-04  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/96698
            PR tree-optimization/96920
            * tree-vectorizer.h (loop_vec_info::reduc_latch_defs): Remove.
            (loop_vec_info::reduc_latch_slp_defs): Likewise.
            * tree-vect-stmts.c (vect_transform_stmt): Remove vectorized
            cycle PHI latch code.
            * tree-vect-loop.c (maybe_set_vectorized_backedge_value): New
            helper to set vectorized cycle PHI latch values.
            (vect_transform_loop): Walk over all PHIs again after
            vectorizing them, calling maybe_set_vectorized_backedge_value.
            Call maybe_set_vectorized_backedge_value for each vectorized
            stmt.  Remove delayed update code.
            * tree-vect-slp.c (vect_analyze_slp_instance): Initialize
            SLP instance reduc_phis member.
            (vect_schedule_slp): Set vectorized cycle PHI latch values.

            * gfortran.dg/vect/pr96920.f90: New testcase.
            * gcc.dg/vect/pr96920.c: Likewise.

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

* [Bug tree-optimization/96920] [10 Regression] ICE segmentation fault in tree-vectorizer at -O3
  2020-09-03 13:26 [Bug fortran/96920] New: ICE segmentation fault in tree-vectorizer at -O3 hj8758558 at gmail dot com
                   ` (4 preceding siblings ...)
  2020-09-04 13:43 ` cvs-commit at gcc dot gnu.org
@ 2020-09-04 13:43 ` rguenth at gcc dot gnu.org
  2020-12-02 11:41 ` cvs-commit at gcc dot gnu.org
  2020-12-02 11:41 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-04 13:43 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |11.0
      Known to fail|11.0                        |
            Summary|[10/11 Regression] ICE      |[10 Regression] ICE
                   |segmentation fault in       |segmentation fault in
                   |tree-vectorizer at -O3      |tree-vectorizer at -O3

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.

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

* [Bug tree-optimization/96920] [10 Regression] ICE segmentation fault in tree-vectorizer at -O3
  2020-09-03 13:26 [Bug fortran/96920] New: ICE segmentation fault in tree-vectorizer at -O3 hj8758558 at gmail dot com
                   ` (5 preceding siblings ...)
  2020-09-04 13:43 ` [Bug tree-optimization/96920] [10 " rguenth at gcc dot gnu.org
@ 2020-12-02 11:41 ` cvs-commit at gcc dot gnu.org
  2020-12-02 11:41 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-12-02 11:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

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

commit r10-9107-ge563687cf9d3d1278f45aaebd03e0f66531076c9
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Sep 4 14:35:39 2020 +0200

    tree-optimization/96920 - another ICE when vectorizing nested cycles

    This refines the previous fix for PR96698 by re-doing how and where
    we arrange for setting vectorized cycle PHI backedge values.

    2020-09-04  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/96698
            PR tree-optimization/96920
            * tree-vectorizer.h (loop_vec_info::reduc_latch_defs): Remove.
            (loop_vec_info::reduc_latch_slp_defs): Likewise.
            * tree-vect-stmts.c (vect_transform_stmt): Remove vectorized
            cycle PHI latch code.
            * tree-vect-loop.c (maybe_set_vectorized_backedge_value): New
            helper to set vectorized cycle PHI latch values.
            (vect_transform_loop): Walk over all PHIs again after
            vectorizing them, calling maybe_set_vectorized_backedge_value.
            Call maybe_set_vectorized_backedge_value for each vectorized
            stmt.  Remove delayed update code.
            * tree-vect-slp.c (vect_analyze_slp_instance): Initialize
            SLP instance reduc_phis member.
            (vect_schedule_slp): Set vectorized cycle PHI latch values.

            * gfortran.dg/vect/pr96920.f90: New testcase.
            * gcc.dg/vect/pr96920.c: Likewise.

    (cherry picked from commit 46a58c779af3055a4b10b285a1f4be28abe4351c)

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

* [Bug tree-optimization/96920] [10 Regression] ICE segmentation fault in tree-vectorizer at -O3
  2020-09-03 13:26 [Bug fortran/96920] New: ICE segmentation fault in tree-vectorizer at -O3 hj8758558 at gmail dot com
                   ` (6 preceding siblings ...)
  2020-12-02 11:41 ` cvs-commit at gcc dot gnu.org
@ 2020-12-02 11:41 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-12-02 11:41 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
      Known to work|                            |10.2.1
             Status|ASSIGNED                    |RESOLVED

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

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

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

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-03 13:26 [Bug fortran/96920] New: ICE segmentation fault in tree-vectorizer at -O3 hj8758558 at gmail dot com
2020-09-03 14:11 ` [Bug tree-optimization/96920] [10/11 Regression] " rguenth at gcc dot gnu.org
2020-09-03 14:12 ` rguenth at gcc dot gnu.org
2020-09-04  9:52 ` rguenth at gcc dot gnu.org
2020-09-04 12:31 ` rguenth at gcc dot gnu.org
2020-09-04 13:43 ` cvs-commit at gcc dot gnu.org
2020-09-04 13:43 ` [Bug tree-optimization/96920] [10 " rguenth at gcc dot gnu.org
2020-12-02 11:41 ` cvs-commit at gcc dot gnu.org
2020-12-02 11:41 ` rguenth 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).