Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29010 Discussions

Compiler bug? A symbol must be a defined parameter in this context

florian_novice
Beginner
1,808 Views
Hello,

the following program throws a compiler error with ifort 12.6.233 and I don't know why:

program main

implicit none
INTEGER, PARAMETER :: ndims = 3
REAL :: p_array(5,4,3)
INTEGER :: idim, icount(ndims)

icount(:) = (/ (SIZE(p_array,idim), idim=1,ndims) /)

END program main

The error is as follows:

example.f90(8): error #6211: A symbol must be a defined parameter in this context. [IDIM]
icount(:) = (/ (SIZE(p_array,idim), idim=1,ndims) /)

I have tested the code with gfortran, NEC compiler, PGI, NAG. None of these encounters any problems...

Best,
Florian
0 Kudos
2 Replies
Ron_Green
Moderator
1,808 Views
Yes, looks like a bug. I don't see anything wrong with this array constructor.

I'll get a bug report started.

ron
0 Kudos
Martyn_C_Intel
Employee
1,808 Views

This issue still isn't fixed. However, it can be worked around by writing the array elements explicitly, instead of in an implied loop:

 icount = (/SIZE(p_array,1),SIZE(p_array,2),SIZE(p_array,3)/)

0 Kudos
Reply