There are numerous places in the library where rank 7
arrays are not handled correctly.  This affects, for example,
in_pack:

$ cat re.f90
program main
  real, dimension (2,2,2,2,2,2,2):: a
  a = 1.0
  call foo(a(2:1:-1,:,:,:,:,:,:))
end program main

subroutine foo(a)
  real, dimension (2,2,2,2,2,2,2):: a
  print *,a
end subroutine foo
$ gfortran re.f90
$ ./a.out
Segmentation fault
$ gfortran -v
Using built-in specs.
Target: ia64-unknown-linux-gnu
Configured with: ../gcc-4.1-20050501/configure --prefix=/home/zfkts --enable-
languages=c,f95
Thread model: posix
gcc version 4.1.0 20050501 (experimental)

plus a whole lot of other intrinsics.

The solution is fairly simple:  All intermediate array declarations
in the library like 

  index_type rstride[GFC_MAX_DIMENSIONS - 1];

need to be changed to

  index_type rstride[GFC_MAX_DIMENSIONS];

-- 
           Summary: Rank 7 not handled correctly
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21354

Reply via email to