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?)