Problem with caracter, parameter array

Problem with caracter, parameter array

Hi all, I note a problem with the attached code, which does not compile with ifort:

$ ifort test.f90 -o test
test.f90(3): error #6364: The upper bound shall not be omitted in the last dimension of a reference to an assumed size array.   [MSG]
 character(len=*), parameter :: msg(*) = (/"abc","123","?!$"/)
--------------------------------^
test.f90(5): error #6364: The upper bound shall not be omitted in the last dimension of a reference to an assumed size array.   [MSG]
 write(*,*) msg
------------^
compilation aborted for test.f90 (code 1)

I think this is a problem in ifort, since there are no assumed size
arrays in the code (it seems like "parameter" is ignored).

$ ifort -V
Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0 Build 20130728

Thank you,
   Marco Restelli

program test
 character(len=*), parameter :: msg(*) = (/"abc","123","?!$"/)
 write(*,*) msg
end program test

4 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

Hi again, I see now that the problem is not specific to character array,

integer, parameter :: msg(*) = (/1,2,3/)

gives the same error. I wonder whether I am wrong assuming that this should work... I can't find any reference for it, but I see gfortran accepts it without warnings even enabling "pedantic" debugging options.

Regards,

Marco Restelli

This is a F2008 feature, implied-shape arrays, we don't yet support. It's on our list to be done eventually.

Steve - Intel Developer Support

Steve, thank you, makes sense.

Marco Restelli

Deixar um comentário

Faça login para adicionar um comentário. Não é membro? Inscreva-se hoje mesmo!