fortransyntax-errorintel-fortran

syntax error while compiling with ifort 11.0


I have a .F90 file having code something like

INTEGER, PARAMETER, PUBLIC  :: Byte    = SELECTED_INT_KIND(1)   ! Byte  integer
INTEGER, PARAMETER, PUBLIC  :: Short   = SELECTED_INT_KIND(4)   ! Short integer
INTEGER, PARAMETER, DIMENSION( N_IP_KINDS ), PRIVATE :: IP_KIND_TYPES = (/ Byte,Short /)

It is compiling successfully with ifort 12, But when i compile using ifort 11.0 it gives following error

ABC.f90(275): error #5082: Syntax error, found ',' when expecting one of: ( %% : . = => INTEGER, PARAMETER, DIMENSION( N_IP_KINDS ), PRIVATE :: IP_KIND_TYPES = (/ Byte, &

It looks like compiler bug. Can anybody tell how to compile this using ifort 11.0 by making any changes in source code


Solution

  • Actually this is a well know bug in ifort 11.0

    You can overcome this by 2 two ways

    1: By upgrade your compiler to ifort 12 2: Modify your source code as below

    INTEGER, PARAMETER, PUBLIC  :: Byte    = SELECTED_INT_KIND(1)   ! Byte  integer
    INTEGER, PARAMETER, PUBLIC  :: Short   = SELECTED_INT_KIND(4)   ! Short integer
    INTEGER, PARAMETER, DIMENSION( N_IP_KINDS ), PRIVATE :: IP_KIND_TYPES = (/ SELECTED_INT_KIND(1),SELECTED_INT_KIND(4) /)