[go: nahoru, domu]

Bug 90004 - [graphite] ICE: Segmentation fault (in scop_get_dependences(scop*))
Summary: [graphite] ICE: Segmentation fault (in scop_get_dependences(scop*))
Status: RESOLVED DUPLICATE of bug 93134
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 9.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: graphite
  Show dependency treegraph
 
Reported: 2019-04-08 08:35 UTC by Arseny Solokha
Modified: 2020-01-09 12:08 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2019-04-08 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arseny Solokha 2019-04-08 08:35:54 UTC
gfortran-9.0.0-alpha20190407 snapshot (r270192) ICEs when compiling the following testcase w/ -O1 -floop-nest-optimize -fwrapv:

subroutine rp (n2, qv)
  integer :: qv
  integer :: n2(5,5,3,0:qv)
  integer :: fi, pj

  do fi = 1, 4
     do pj = 1, 2
        n2(fi,pj,1,0) = 0
        n2(fi,pj,2,0) = 0
        n2(fi,pj,3,0) = 0
        n2(fi,pj,1,qv) = 0
        n2(fi,pj,2,qv) = 0
        n2(fi,pj,3,qv) = 0
     enddo
  enddo

  do fi = 1, 3
     n2(fi,fi,2,0) = 0
     n2(fi,fi,2,qv) = 0
  enddo
end subroutine rp

% powerpc-e300c3-linux-gnu-gfortran-9.0.0-alpha20190407 -O1 -floop-nest-optimize -fwrapv -c mlsputpr.f90
during GIMPLE pass: graphite
mlsputpr.f90:1:0:

    1 | subroutine rp (n2, qv)
      | 
internal compiler error: Segmentation fault
0xd83f96 crash_signal
	/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-9.0.0_alpha20190407/work/gcc-9-20190407/gcc/toplev.c:326
0x14ba478 scop_get_dependences(scop*)
	/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-9.0.0_alpha20190407/work/gcc-9-20190407/gcc/graphite-dependences.c:316
0x14ba9f6 optimize_isl
	/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-9.0.0_alpha20190407/work/gcc-9-20190407/gcc/graphite-optimize-isl.c:126
0x14ba9f6 apply_poly_transforms(scop*)
	/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-9.0.0_alpha20190407/work/gcc-9-20190407/gcc/graphite-optimize-isl.c:212
0x14b4be0 graphite_transform_loops()
	/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-9.0.0_alpha20190407/work/gcc-9-20190407/gcc/graphite.c:468
0x14b5190 graphite_transforms
	/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-9.0.0_alpha20190407/work/gcc-9-20190407/gcc/graphite.c:538
0x14b5190 execute
	/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-9.0.0_alpha20190407/work/gcc-9-20190407/gcc/graphite.c:615

I have isl 0.21 installed on this machine.
Comment 1 Richard Biener 2019-04-08 12:12:25 UTC
Can reproduce on x86_64-linux with -m32 with ISL 0.21 but not ISL 0.20.  The
crash happens inside ISL though:

internal compiler error: Segmentation fault
0x1239033 crash_signal
        /tmp/trunk/gcc/toplev.c:326
0x7effbfe50fdf ???
        /usr/src/debug/glibc-2.22/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0x22b65b0 normalize_divs
        /tmp/trunk/isl/isl_map_simplify.c:1044
0x22b7b59 isl_basic_map_simplify
        /tmp/trunk/isl/isl_map_simplify.c:1435
0x22986e8 isl_basic_map_intersect
        /tmp/trunk/isl/isl_map.c:3569
0x2298d35 map_intersect_internal
        /tmp/trunk/isl/isl_map.c:3703
0x2298e5e map_intersect
        /tmp/trunk/isl/isl_map.c:3729
0x22932d8 isl_map_align_params_map_map_and
        /tmp/trunk/isl/isl_map.c:1442
0x2298ea7 isl_map_intersect
        /tmp/trunk/isl/isl_map.c:3739
0x2298ee0 isl_set_intersect
        /tmp/trunk/isl/isl_map.c:3744
0x22a0be2 isl_map_partial_lexopt_aligned_pw_multi_aff
        /tmp/trunk/isl/isl_map.c:6799
0x22a1252 isl_map_partial_lexopt_aligned
        /tmp/trunk/isl/isl_map.c:6877
0x22a0ff5 isl_map_partial_lexopt
        /tmp/trunk/isl/isl_map_lexopt_templ.c:182
0x22a12c2 isl_map_partial_lexmax
        /tmp/trunk/isl/isl_map.c:6892
0x227ad0f restricted_partial_lexmax
        /tmp/trunk/isl/isl_flow.c:590
0x227b005 last_source
        /tmp/trunk/isl/isl_flow.c:651
0x227c62f compute_val_based_dependences
        /tmp/trunk/isl/isl_flow.c:1204
0x227cda2 access_info_compute_flow_core
        /tmp/trunk/isl/isl_flow.c:1338
0x227fbfc compute_single_flow
        /tmp/trunk/isl/isl_flow.c:3094
0x227fef2 compute_flow_schedule
        /tmp/trunk/isl/isl_flow.c:3178
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.

Program received signal SIGSEGV, Segmentation fault.
0x00000000022b65b0 in normalize_divs (bmap=0x0, progress=0x7fffffffd078)
    at /tmp/trunk/isl/isl_map_simplify.c:1044
1044                    for (i = 0; i < bmap->n_eq; ++i)
...
#19 0x0000000001fa482d in scop_get_dependences (scop=0x34ea320)
    at /tmp/trunk/gcc/graphite-dependences.c:316
316       flow = isl_union_access_info_compute_flow (ai);

not sure if it is still GCCs fault in the end or not.  At least there's

(gdb) l
1430                    bmap = eliminate_unit_divs(bmap, &progress);
1431                    bmap = eliminate_divs_eq(bmap, &progress);
1432                    bmap = eliminate_divs_ineq(bmap, &progress);
1433                    bmap = isl_basic_map_gauss(bmap, &progress);
1434                    /* requires equalities in normal form */
1435                    bmap = normalize_divs(bmap, &progress);

and isl_basic_map_gauss has paths where it can return NULL.
Comment 2 Arseny Solokha 2019-10-06 05:26:36 UTC
Now I can reproduce it w/ the current gcc 10 snapshot when compiling the following testcase for x86_64 using isl 0.21:

int *
w3 (int *b9, int l2)
{
  const int j9 = 8;
  int mq, fv;
  double dd = 0.0;
  double px[2];

  for (mq = 0; mq < j9; ++mq)
    dd += b9[mq * j9];

  px[0] = dd;
  for (fv = 0; fv < j9; ++fv)
    for (mq = 0; mq < j9; ++mq)
      b9[mq * j9 + fv] = px[l2];

  return b9;
}

% x86_64-unknown-linux-gnu-gcc-10.0.0-alpha20190929 -O3 -floop-nest-optimize -fwrapv-pointer -c nmyaunhz.c
during GIMPLE pass: graphite
nmyaunhz.c: In function 'w3':
nmyaunhz.c:2:1: internal compiler error: Segmentation fault
    2 | w3 (int *b9, int l2)
      | ^~
0xd6e74e crash_signal
	/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/toplev.c:326
0x15f2165 scop_get_dependences(scop*)
	/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/graphite-dependences.c:316
0x15f2568 optimize_isl
	/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/graphite-optimize-isl.c:126
0x15f2568 apply_poly_transforms(scop*)
	/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/graphite-optimize-isl.c:212
0x15ec615 graphite_transform_loops()
	/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/graphite.c:468
0x15ed3c6 graphite_transforms
	/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/graphite.c:538
0x15ed3c6 execute
	/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/graphite.c:615
Comment 3 Arseny Solokha 2019-11-12 02:38:51 UTC
I cannot reproduce the first ICE w/ the current gcc trunk snapshot and isl 0.22 anymore. The second one still fails for me:

#0  0x00007ffff7ec7fe4 in isl_basic_map_underlying_set () from /usr/lib64/libisl.so.22
#1  0x00007ffff7ec3981 in isl_basic_map_is_empty () from /usr/lib64/libisl.so.22
#2  0x00007ffff7eaf501 in ?? () from /usr/lib64/libisl.so.22
#3  0x00007ffff7eb2e5b in ?? () from /usr/lib64/libisl.so.22
#4  0x00007ffff7eec098 in ?? () from /usr/lib64/libisl.so.22
#5  0x00007ffff7eecccb in isl_union_access_info_compute_flow () from /usr/lib64/libisl.so.22
#6  0x000000000159db5c in scop_get_dependences (scop=scop@entry=0x1eee960)
    at /var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-10.0.0_alpha20191110/work/gcc-10-20191110/gcc/graphite-dependences.c:316
#7  0x000000000159e0e0 in optimize_isl (scop=0x1eee960)
    at /var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-10.0.0_alpha20191110/work/gcc-10-20191110/gcc/graphite-optimize-isl.c:126

<…>

I have another Fortran testcase that ICEs in isl_basic_map_underlying_set(), though w/ a different backtrace.
Comment 4 Arseny Solokha 2019-12-25 10:43:42 UTC
(In reply to Arseny Solokha from comment #3)
> I cannot reproduce the first ICE w/ the current gcc trunk snapshot and isl
> 0.22 anymore.

I've finally managed to get the initial backtrace w/ isl 0.22.

subroutine ww (xk, ha, ku, bh)
  real :: ha, xk(5,0:12,0:12,0:12)
  integer :: f9, i5, c1, ku, bh

  do i5 = 1, bh
     do f9 = 1, ku
        xk(0,f9,i5,0) = 0.0
        xk(3,f9,i5,0) = ha
     enddo
  enddo
end subroutine ww

% powerpc-e300c3-linux-gnu-gfortran-10.0.0-alpha20191222 -O1 -floop-parallelize-all -fno-aggressive-loop-optimizations -w -c hwdwngqs.f90
during GIMPLE pass: graphite
hwdwngqs.f90:1:0:

    1 | subroutine ww (xk, ha, ku, bh)
      | 
internal compiler error: Segmentation fault
0xe7c536 crash_signal
	/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-10.0.0_alpha20191222/work/gcc-10-20191222/gcc/toplev.c:328
0x165638b scop_get_dependences(scop*)
	/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-10.0.0_alpha20191222/work/gcc-10-20191222/gcc/graphite-dependences.c:316
0x1653957 translate_isl_ast_to_gimple::scop_to_isl_ast(scop*)
	/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-10.0.0_alpha20191222/work/gcc-10-20191222/gcc/graphite-isl-ast-to-gimple.c:1399
0x1655282 graphite_regenerate_ast_isl(scop*)
	/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-10.0.0_alpha20191222/work/gcc-10-20191222/gcc/graphite-isl-ast-to-gimple.c:1479
0x1650b6d graphite_transform_loops()
	/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-10.0.0_alpha20191222/work/gcc-10-20191222/gcc/graphite.c:471
0x1651160 graphite_transforms
	/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-10.0.0_alpha20191222/work/gcc-10-20191222/gcc/graphite.c:537
0x1651160 execute
	/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-10.0.0_alpha20191222/work/gcc-10-20191222/gcc/graphite.c:614
Comment 5 Arseny Solokha 2020-01-09 12:08:01 UTC
Patch [1] fixes all three ICEs in this PR.

[1] https://groups.google.com/forum/#!original/isl-development/Otz1QKZDpzA/71GkTvqkCAAJ

*** This bug has been marked as a duplicate of bug 93134 ***