PGF90-F-0000-ICE. Subscript for array is out-of-bounds

I’ve hit an ICE that I’m not sure if it’s due to the complex nature of this array declaration or due to something wrong in PGI 10.4. To wit, when I try to compile a certain .f90 file, I get:

PGF90-F-0000-Internal compiler error. Subscript for array is out-of-bounds       0 (modistest.f90: 17)

Now the relevant lines of code to look at this error are:

  1 program modistest
  2 
  3 implicit none
  4 
  5 real, parameter :: min_OpticalThickness = 0.3
  6 
  7 integer, parameter :: numTauHistogramBins = 6
  8 
  9 real :: dummy_real
 10 real, dimension(numTauHistogramBins + 1),      parameter :: &
 11   tauHistogramBoundaries = (/ min_OpticalThickness, 1.3, 3.6, 9.4, 23., 60., huge(dummy_real) /)
 12 
 13 !
 14 ! For output - nominal bin centers and  bin boundaries. On output pressure bins are highest to lowest. 
 15 !
 16 integer :: k, l
 17 real, parameter, dimension(2, numTauHistogramBins) ::   &
 18   nominalTauHistogramBoundaries =                       &
 19       reshape(source = (/ tauHistogramBoundaries(1),    &
 20                           ((tauHistogramBoundaries(k), l = 1, 2), k = 2, numTauHistogramBins), &
 21                           100000.0 /),                    &
 22               shape = (/2,  numTauHistogramBins /) )
 23 
 24 write (*,*) nominalTauHistogramBoundaries
 25 
 26 
 27 end program modistest

Now, I spent a bit of time puzzling over line 17 and I think what it does is reshape this array (let tau(i)= tauHistogramBoundaries(i)):

[ tau(1),  tau(2), tau(2),  tau(3),  tau(3), tau(4), tau(4), tau(5), tau(5), tau(6), tau(6), 100000.0 ]

into this 2x6 array:

( tau(1) tau(2) tau(3) tau(4) tau(5) tau(6)
  tau(2) tau(3) tau(4) tau(5) tau(6) 100000.0 )

So, why is this throwing an ICE?

(I should note that the “real” file this code comes from does compile with ifort 11, so perhaps PGI is a bit strict with this?)

Sorry for the double post, but I just replaced the above code-snippet from a large module with a small file that can be run.

Hi Matt,

It appears to me that the compiler is having trouble doing the expansion of “(tauHistogramBoundaries(k), l = 1, 2), k = 2, numTauHistogramBins)” within this context. I’ve sent a report to our engineers for further investigation (TPR#16926).

Two possible work-arounds are to either remove “parameter” from “nominalTauHistogramBoundaries” and do the initialization in the executable portion of the code, or manually expand the implied do loop.

For example:

% cat test1.f90


program modistest
   implicit none

   real, parameter :: min_OpticalThickness = 0.3

   integer, parameter :: numTauHistogramBins = 6

   real :: dummy_real
  real, dimension(numTauHistogramBins + 1),      parameter :: &
    tauHistogramBoundaries = (/ min_OpticalThickness, 1.3, 3.6, 9.4, 23., 60., huge(dummy_real) /)

 !
 ! For output - nominal bin centers and  bin boundaries. On output pressure bins are highest to lowest.
 !
 integer :: k, l
 real, parameter, dimension(2, numTauHistogramBins) ::   &
  nominalTauHistogramBoundaries =                       &
       reshape(source = (/ tauHistogramBoundaries(1),    &
!                           ((tauHistogramBoundaries(k), l = 1, 2), k = 2, numTauHistogramBins), &
                          tauHistogramBoundaries(2), tauHistogramBoundaries(2), &
                          tauHistogramBoundaries(3), tauHistogramBoundaries(3), &
                          tauHistogramBoundaries(4), tauHistogramBoundaries(4), &
                          tauHistogramBoundaries(5), tauHistogramBoundaries(5), &
                          tauHistogramBoundaries(numTauHistogramBins),  &
                          tauHistogramBoundaries(numTauHistogramBins),  &
                           100000.0 /),                    &
               shape = (/2,  numTauHistogramBins /) )

 write (*,*) nominalTauHistogramBoundaries


end program modistest

% pgf90 -V10.4 test1.f90
% a.out
   0.3000000        1.300000        1.300000        3.600000
    3.600000        9.400000        9.400000        23.00000
    23.00000        60.00000        60.00000        100000.0

Thanks,
Mat

Mat,

I just saw in the TPR list that TPR#16926 was fixed in 10.9 and yet when I run my code snippet above:

pgfortran modistest.f90
PGF90-F-0000-Internal compiler error. Subscript for array is out-of-bounds 0 (modistest.f90: 17)
PGF90/x86-64 Linux 10.9-0: compilation aborted

Is there an option I need to specify to get this to work?

Hi Matt,

I must apologize for this since it’s something that I should have caught. The fix for TPR#16926 appears to have been scheduled for inclusion in 10.9 but apparently was not. I have verified this error is resolved in the pre-released 11.0 compiler which is scheduled for release at the beginning of December.

  • Mat

Matt,

TPR 16926 - ICE Subscript for array is out-of-bounds

has been corrected in the 11.0 release, available now.

regards,
dave