[Bug tree-optimization/71351] New: [7 Regression] ICE: Segmentation fault

classic Classic list List threaded Threaded
21 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/71351] New: [7 Regression] ICE: Segmentation fault

thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71351

            Bug ID: 71351
           Summary: [7 Regression] ICE: Segmentation fault
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Joost.VandeVondele at mat dot ethz.ch
  Target Milestone: ---

recent trunk regression:

> cat bug.f90
MODULE k290
  INTEGER, PARAMETER :: dp=8
  TYPE csym_type
      INTEGER   :: isy, nc
      REAL(KIND=dp), DIMENSION(3,48) :: v
  END TYPE csym_type
CONTAINS
  SUBROUTINE print_crys_symmetry(csym)
    TYPE(csym_type), POINTER  :: csym
    INTEGER  :: n,i, unit
    vs = 0.0_dp
    DO n = 1, csym%nc
       DO i = 1, 3
          vs = vs + ABS(csym%v(i,n))
       END DO
    END DO
    IF (csym%isy==0) THEN
       WRITE (unit,*) &
            ' (sum of translation vectors=', vs, ')'
    END IF
    IF (indpg>0) THEN
       CALL xstring(pgrp(-indpg),i,j)
    END IF
  END SUBROUTINE print_crys_symmetry
END MODULE k290

> gfortran  -c -O2 -floop-nest-optimize bug.f90
bug.f90:8:0:

   SUBROUTINE print_crys_symmetry(csym)

internal compiler error: Segmentation fault
0xba222f crash_signal
        ../../gcc/gcc/toplev.c:333
0xbf6247 ssa_default_def(function*, tree_node*)
        ../../gcc/gcc/tree-dfa.c:305
0xbf87a8 get_or_create_ssa_default_def(function*, tree_node*)
        ../../gcc/gcc/tree-dfa.c:357
0xc33ab3 get_reaching_def
        ../../gcc/gcc/tree-into-ssa.c:1172
0xc33ab3 get_reaching_def
        ../../gcc/gcc/tree-into-ssa.c:1159
0xc340e7 rewrite_update_phi_arguments
        ../../gcc/gcc/tree-into-ssa.c:2025
0xc340e7 rewrite_update_dom_walker::before_dom_children(basic_block_def*)
        ../../gcc/gcc/tree-into-ssa.c:2145
0xc340e7 rewrite_update_dom_walker::before_dom_children(basic_block_def*)
        ../../gcc/gcc/tree-into-ssa.c:2078
0x12d2330 dom_walker::walk(basic_block_def*)
        ../../gcc/gcc/domwalk.c:265
0xc2fc67 rewrite_blocks
        ../../gcc/gcc/tree-into-ssa.c:2202
0xc372f8 update_ssa(unsigned int)
        ../../gcc/gcc/tree-into-ssa.c:3364
0x12fd6ea graphite_regenerate_ast_isl(scop*)
        ../../gcc/gcc/graphite-isl-ast-to-gimple.c:3203
0x12f4cb3 graphite_transform_loops()
        ../../gcc/gcc/graphite.c:329
0x12f5180 graphite_transforms
        ../../gcc/gcc/graphite.c:356
0x12f5180 execute
        ../../gcc/gcc/graphite.c:433
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/71351] [7 Regression] ICE: Segmentation fault

thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71351

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |trippels at gcc dot gnu.org

--- Comment #1 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Probably a dup of PR71142
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/71351] [7 Regression] ICE: Segmentation fault

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71351

Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Joost.VandeVondele at mat dot ethz
                   |                            |.ch

--- Comment #2 from Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> ---
simplified:

> cat bug.f90
  SUBROUTINE print_crys_symmetry(nc,v)
    INTEGER :: nc
    REAL(KIND=8), DIMENSION(3,48) :: v
    INTEGER  :: n,i
    vs = 0.0_8
    DO n = 1, nc
       DO i = 1, 3
          vs = vs + ABS(v(i,n))
       END DO
    END DO
    CALL foo(vs)
  END SUBROUTINE print_crys_symmetry

> gfortran  -c -O2 -floop-nest-optimize bug.f90
bug.f90:1:0:

   SUBROUTINE print_crys_symmetry(nc,v)

internal compiler error: Segmentation fault
0xba222f crash_signal
        ../../gcc/gcc/toplev.c:333
0xbf6247 ssa_default_def(function*, tree_node*)
        ../../gcc/gcc/tree-dfa.c:305
0xbf87a8 get_or_create_ssa_default_def(function*, tree_node*)
        ../../gcc/gcc/tree-dfa.c:357
0xc33ab3 get_reaching_def
        ../../gcc/gcc/tree-into-ssa.c:1172
0xc33ab3 get_reaching_def
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/71351] [7 Regression] ICE: Segmentation fault

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71351

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-05-31
   Target Milestone|---                         |7.0
     Ever confirmed|0                           |1

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
The graphite transform does sth weird here ending up with a def not dominated
by its use.
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/71351] [7 Regression] ICE: Segmentation fault (graphite)

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71351

Jeffrey A. Law <law at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
                 CC|                            |law at redhat dot com
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/71351] [7 Regression] ICE: Segmentation fault (graphite)

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71351

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r236440.
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/71351] [7 Regression] ICE: Segmentation fault (graphite)

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71351

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
Just our of curiosity, why graphite does a transformation as original and AST
are same:

[scheduler] original ast:
{
  for (int c0 = 0; c0 < P_19; c0 += 1) {
    S_4(c0);
    for (int c1 = 0; c1 <= 2; c1 += 1)
      S_5(c0, c1);
    S_7(c0);
  }
  S_9();
}

[scheduler] AST generated by isl:
{
  for (int c0 = 0; c0 < P_19; c0 += 1) {
    S_4(c0);
    for (int c1 = 0; c1 <= 2; c1 += 1)
      S_5(c0, c1);
    S_7(c0);
  }
  S_9();
}

Doing a transformation should be easy in that case.
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/71351] [7 Regression] ICE: Segmentation fault (graphite)

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71351

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ktkachov at gcc dot gnu.org

--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
*** Bug 71142 has been marked as a duplicate of this bug. ***
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/71351] [7 Regression] ICE: Segmentation fault (graphite)

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71351

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
sese_insert_phis_for_liveouts looks like complete bollocks in this case.  We're
missing a definition that could be used for updating.
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/71351] [7 Regression] ICE: Segmentation fault (graphite)

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71351

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |spop at gcc dot gnu.org

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Also ICEs with -fgraphite-identity.

The issue seems to be that ISL creates a new loop guard but the loop has a
loop-close PHI node and we fail to generate/know the value to use on the
edge that skips the loop.  The condition we try to insert is _19 > 0
(that's trivially true by means of a dominating condition).

Not sure how this is supposed to work for reductions when the orginal loops
guard is not in the SESE region.  That guard looks like

  _19 = *nc_18(D);
  if (_19 <= 0)
    ...

so the BB is rejected because _19 = *nc_18(D) isn't a valid stmt.  So for this
case it might help if we'd split that block...

Anyway, it looks like we have to fail code generation here somehow... (no good
idea how).
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/71351] [7/8 Regression] ICE: Segmentation fault (graphite)

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71351

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|7.0                         |7.2

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 7.1 has been released.
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/71351] [7/8 Regression] ICE: Segmentation fault (graphite)

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71351

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|7.2                         |7.3

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 7.2 is being released, adjusting target milestone.

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 7.2 is being released, adjusting target milestone.
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/71351] [7/8 Regression] ICE: Segmentation fault (graphite)

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71351

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|7.2                         |7.3

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 7.2 is being released, adjusting target milestone.

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 7.2 is being released, adjusting target milestone.
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/71351] [7/8 Regression] ICE: Segmentation fault (graphite)

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71351

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|7.2                         |7.3
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/71351] [7/8 Regression] ICE: Segmentation fault (graphite)

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71351

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
I _think_ that the proper fix is to _not_ code-gen additional loop guards
because we can't possibly get the PHIs correct there.  Iff a loop needs a guard
then it will be present before.  So the only case we'd need an extra guard is
when the loop didn't have do { } while () style but we reject that case in
can_represent_loop_1 because there we require that number_of_latch_executions
is scev-analyzable.  But SCEV doesn't handle niters like

n_6(D) > 0 ? (unsigned int) n_6(D) + 4294967295 : 0

that is, we effectively reject ->may_be_zero.

Testing patch to remove the additional conditions (it passed SPEC CPU 2006 w/o
any issues in a train run).
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/71351] [7/8 Regression] ICE: Segmentation fault (graphite)

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71351

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/71351] [7 Regression] ICE: Segmentation fault (graphite)

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71351

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |8.0
            Summary|[7/8 Regression] ICE:       |[7 Regression] ICE:
                   |Segmentation fault          |Segmentation fault
                   |(graphite)                  |(graphite)

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk.
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/71351] [7 Regression] ICE: Segmentation fault (graphite)

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71351

--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Thu Sep 21 10:08:21 2017
New Revision: 253052

URL: https://gcc.gnu.org/viewcvs?rev=253052&root=gcc&view=rev
Log:
2017-09-21  Richard Biener  <[hidden email]>

        PR tree-optimization/71351
        * graphite-isl-ast-to-gimple.c (translate_isl_ast_to_gimple::
        graphite_create_new_loop_guard): Remove, fold remaining parts
        into caller ...
        (translate_isl_ast_node_for): ... here and simplify.

        * gfortran.dg/graphite/pr71351.f90: New testcase.
        * gfortran.dg/graphite/interchange-3.f90: Adjust.

Added:
    trunk/gcc/testsuite/gfortran.dg/graphite/pr71351.f90
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/graphite-isl-ast-to-gimple.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/graphite/interchange-3.f90
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/71351] [7 Regression] ICE: Segmentation fault (graphite)

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71351

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|7.3                         |7.4

--- Comment #13 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 7.3 is being released, adjusting target milestone.
Reply | Threaded
Open this post in threaded view
|

[Bug tree-optimization/71351] [7 Regression] ICE: Segmentation fault (graphite)

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71351

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|7.4                         |7.5
12