[go: nahoru, domu]

Bug 71144 - [11/12/13/14/15 Regression] isl_aff.c:1001: position out of bounds
Summary: [11/12/13/14/15 Regression] isl_aff.c:1001: position out of bounds
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 7.0
: P4 normal
Target Milestone: 11.5
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks: graphite
  Show dependency treegraph
 
Reported: 2016-05-16 09:37 UTC by ktkachov
Modified: 2024-04-26 10:31 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work: 5.3.1
Known to fail: 6.1.0, 7.0
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ktkachov 2016-05-16 09:37:21 UTC
The testcase:
int a, c, d, e, f;
int b[1];
short g;

void
fn1 ()
{
  for (; a; a++)
    if (f)
      for (; e; e--)
        {
          d = 0;
          for (; d <= 0; d++)
            if (c)
              break;
          (g = a) || (b[a] = 0);
        }
}


ICEs with -Ofast -floop-interchange:
../../gcc/isl/isl_aff.c:1001: position out of bounds
mycrash.c: In function ‘fn1’:
mycrash.c:6:1: internal compiler error: Aborted
 fn1 ()
 ^~~
0xbab71f crash_signal
	../../gcc/gcc/toplev.c:333
0x13a4fe2 isl_handle_error
	../../gcc/isl/isl_ctx.c:96
0x1365fa1 isl_aff_set_coefficient_si
	../../gcc/isl/isl_aff.c:1000
0x12342da extract_affine_chrec
	../../gcc/gcc/graphite-sese-to-poly.c:239
0x12342da extract_affine
	../../gcc/gcc/graphite-sese-to-poly.c:381
0x123418e extract_affine
	../../gcc/gcc/graphite-sese-to-poly.c:421
0x123523d add_condition_to_pbb
	../../gcc/gcc/graphite-sese-to-poly.c:458
0x123523d add_conditions_to_domain
	../../gcc/gcc/graphite-sese-to-poly.c:525
0x123523d build_iteration_domains
	../../gcc/gcc/graphite-sese-to-poly.c:1017
0x1234fe5 build_iteration_domains
	../../gcc/gcc/graphite-sese-to-poly.c:1040
0x123579f build_poly_scop(scop*)
	../../gcc/gcc/graphite-sese-to-poly.c:1364
0x121fb9a graphite_transform_loops()
	../../gcc/gcc/graphite.c:319
0x12201a0 graphite_transforms
	../../gcc/gcc/graphite.c:356
0x12201a0 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.

This is using ISL 0.15 as downloaded from contrib/download_prerequisites.
Don't know if this is an ISL bug or a bug in the way GCC communicates with it.
Comment 1 Dominik Vogt 2016-06-21 11:17:41 UTC
I get (pprobably) the same ICE on s390x with today's devel branch in pr68279.f90.  Reduced test case (which intentionally has some out of bound array accesses):

MODULE foo 
  CONTAINS 
  SUBROUTINE bar(o) 
    INTEGER, DIMENSION(2, 1) :: a 
    INTEGER, DIMENSION(1) :: b 
    INTEGER, DIMENSION(1, 1) :: o 
    INTEGER :: d 
     DO i=1,2 
        b(1:2) = b(1:2) 
        o(1:1, 1:d) = a(1:1, 1:d) 
        a(1:2, 2) = b(1:2) 
        d = d + 1 
     END DO 
  END SUBROUTINE bar 
END MODULE 

==>

.../gcc/testsuite/gfortran2/../../gfortran -B.../gcc/testsuite/gfortran2/../../ -B.../s390x-ibm-linux-gnu/32/libgfortran/ x.f90 -floop-nest-optimize -O1 -S -m64
x.f90:9:10:

         b(1:2) = b(1:2)
          1
Warning: Upper array reference at (1) is out of bounds (2 > 1) in dimension 1
x.f90:9:19:

         b(1:2) = b(1:2)
                   1
Warning: Upper array reference at (1) is out of bounds (2 > 1) in dimension 1
x.f90:11:15:

         a(1:2, 2) = b(1:2)
               1
Warning: Array reference at (1) is out of bounds (2 > 1) in dimension 2
x.f90:11:22:

         a(1:2, 2) = b(1:2)
                      1
Warning: Upper array reference at (1) is out of bounds (2 > 1) in dimension 1
isl_aff.c:944: position out of bounds
x.f90:3:0:

   SUBROUTINE bar(o)
 
internal compiler error: Aborted
0x806bd397 crash_signal
	/home/vogt/src/t/gcc/toplev.c:335
0x80b3b683 extract_affine_chrec
	/home/vogt/src/t/gcc/graphite-sese-to-poly.c:239
0x80b3b683 extract_affine
	/home/vogt/src/t/gcc/graphite-sese-to-poly.c:381
0x80b3b8b7 extract_affine
	/home/vogt/src/t/gcc/graphite-sese-to-poly.c:421
0x80b3c52d add_condition_to_pbb
	/home/vogt/src/t/gcc/graphite-sese-to-poly.c:458
0x80b3c52d add_conditions_to_domain
	/home/vogt/src/t/gcc/graphite-sese-to-poly.c:525
0x80b3c52d build_iteration_domains
	/home/vogt/src/t/gcc/graphite-sese-to-poly.c:1017
0x80b3c2dd build_iteration_domains
	/home/vogt/src/t/gcc/graphite-sese-to-poly.c:1040
0x80b3c95f build_poly_scop(scop*)
	/home/vogt/src/t/gcc/graphite-sese-to-poly.c:1364
0x80b296c9 graphite_transform_loops()
	/home/vogt/src/t/gcc/graphite.c:319
0x80b29c4f graphite_transforms
	/home/vogt/src/t/gcc/graphite.c:356
0x80b29c4f execute
	/home/vogt/src/t/gcc/graphite.c:433
Comment 2 Arseny Solokha 2016-07-06 03:02:13 UTC
I cannot reproduce this ICE w/ testcase from #c0, compiling it w/ current gcc 7 snapshot for both x86_64 and 32-bit powerpc. Note that I have ISL 0.17.1 installed. However, I see a similar ICE on both archs w/ the following testcase:

int j6, u6, ip;
int vi[2], sx[3];

void
i0 (void)
{
  for (ip = 0; ip < 2; ++ip)
    {
      static int xj[2] = { 0 };

      for (j6 = 0; j6 < 2; ++j6)
        u6 = xj[j6];
      if (xj[ip] != 0)
        u6 = sx[ip + 1];
      for (j6 = 0; j6 < 2; ++j6)
        vi[j6] = 0;
    }
}

% x86_64-pc-linux-gnu-gcc-7.0.0-alpha20160703 -c -O2 -floop-nest-optimize uagtztry.c
isl-0.17.1/work/isl-0.17.1/isl_aff.c:1019: position out of bounds
uagtztry.c: In function 'i0':
uagtztry.c:5:1: internal compiler error: Aborted
 i0 (void)
 ^~
Comment 3 Richard Biener 2016-08-22 08:17:06 UTC
GCC 6.2 is being released, adjusting target milestone.
Comment 4 Richard Biener 2016-08-22 08:18:09 UTC
GCC 6.2 is being released, adjusting target milestone.
Comment 5 Jakub Jelinek 2016-12-21 10:58:14 UTC
GCC 6.3 is being released, adjusting target milestone.
Comment 6 Dominik Vogt 2017-02-06 16:00:00 UTC
This no longer happens with current trunk.  The warnings are still present, but the ICE is gone:

(In reply to Dominik Vogt from comment #1)
> I get (pprobably) the same ICE on s390x with today's devel branch in
> pr68279.f90.  Reduced test case (which intentionally has some out of bound
> array accesses):
> 
> MODULE foo 
>   CONTAINS 
>   SUBROUTINE bar(o) 
>     INTEGER, DIMENSION(2, 1) :: a 
>     INTEGER, DIMENSION(1) :: b 
>     INTEGER, DIMENSION(1, 1) :: o 
>     INTEGER :: d 
>      DO i=1,2 
>         b(1:2) = b(1:2) 
>         o(1:1, 1:d) = a(1:1, 1:d) 
>         a(1:2, 2) = b(1:2) 
>         d = d + 1 
>      END DO 
>   END SUBROUTINE bar 
> END MODULE 

> internal compiler error: Aborted
> 0x806bd397 crash_signal
> 	/home/vogt/src/t/gcc/toplev.c:335
> 0x80b3b683 extract_affine_chrec
> 	/home/vogt/src/t/gcc/graphite-sese-to-poly.c:239
> 0x80b3b683 extract_affine
> 	/home/vogt/src/t/gcc/graphite-sese-to-poly.c:381
> 0x80b3b8b7 extract_affine
> 	/home/vogt/src/t/gcc/graphite-sese-to-poly.c:421
> 0x80b3c52d add_condition_to_pbb
> 	/home/vogt/src/t/gcc/graphite-sese-to-poly.c:458
> 0x80b3c52d add_conditions_to_domain
> 	/home/vogt/src/t/gcc/graphite-sese-to-poly.c:525
> 0x80b3c52d build_iteration_domains
> 	/home/vogt/src/t/gcc/graphite-sese-to-poly.c:1017
> 0x80b3c2dd build_iteration_domains
> 	/home/vogt/src/t/gcc/graphite-sese-to-poly.c:1040
> 0x80b3c95f build_poly_scop(scop*)
> 	/home/vogt/src/t/gcc/graphite-sese-to-poly.c:1364
> 0x80b296c9 graphite_transform_loops()
> 	/home/vogt/src/t/gcc/graphite.c:319
> 0x80b29c4f graphite_transforms
> 	/home/vogt/src/t/gcc/graphite.c:356
> 0x80b29c4f execute
> 	/home/vogt/src/t/gcc/graphite.c:433
Comment 7 Dominik Vogt 2017-02-06 17:58:09 UTC
The ICE (s390x) has gone away with this commit:

    2017-01-31  Richard Biener  <rguenther@suse.de>

        PR tree-optimization/77318
        * graphite-sese-to-poly.c (extract_affine): Fix assert.
        (create_pw_aff_from_tree): Take loop parameter.
        (add_condition_to_pbb): Pass loop of the condition to
        create_pw_aff_from_tree.


    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245064 138bc75d-0d04-0410-96
Comment 8 Richard Biener 2017-07-04 08:47:56 UTC
GCC 6.4 is being released, adjusting target milestone.
Comment 9 Arseny Solokha 2018-05-26 03:45:26 UTC
I can reproduce ICEs w/ C testcases from comments 0 and 2 only w/ gcc 6.3. I believe the issue is fixed on 7 and all newer branches.
Comment 10 Jakub Jelinek 2018-10-26 10:21:57 UTC
GCC 6 branch is being closed
Comment 11 Richard Biener 2019-11-14 07:51:36 UTC
The GCC 7 branch is being closed, re-targeting to GCC 8.4.
Comment 12 Arseny Solokha 2019-11-14 15:02:02 UTC
I believe this PR can be closed, per comment 9 (and likely comment 7).
Comment 13 Jakub Jelinek 2020-03-04 09:43:30 UTC
GCC 8.4.0 has been released, adjusting target milestone.
Comment 14 Jakub Jelinek 2021-05-14 09:48:20 UTC
GCC 8 branch is being closed.
Comment 15 Richard Biener 2021-06-01 08:07:59 UTC
GCC 9.4 is being released, retargeting bugs to GCC 9.5.
Comment 16 Richard Biener 2022-05-27 09:36:26 UTC
GCC 9 branch is being closed
Comment 17 Jakub Jelinek 2022-06-28 10:32:19 UTC
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
Comment 18 Richard Biener 2023-07-07 10:31:26 UTC
GCC 10 branch is being closed.