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

Length type parameters

IanH
Honored Contributor III
375 Views

(I read section of 3.5.5 the release notes (! - do I get a medal?), but this looks different.  (%RE and %IM in the list in that section aren't length type parameters))

PROGRAM x
  IMPLICIT NONE
  TYPE :: t(l)
    INTEGER, LEN :: l
    INTEGER :: component(l)
  END TYPE T
  
  TYPE(t(:)), ALLOCATABLE :: a
  
  ALLOCATE(t(6) :: a)
  a%component(1) = 1
  PRINT *, a%component(1)
END PROGRAM x

 

>ifort /check:all /warn:all /standard-semantics /traceback "2014-11-24 len-param.f90" && "2014-11-24 len-param.exe"
Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.1.148 Build 201410
23
Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.

2014-11-24 len-param.f90(11): warning #5479: Subscript #1 of the array COMPONENT has value 1 which is greater than the u
pper bound of 0
  a%component(1) = 1
--^
2014-11-24 len-param.f90(12): warning #5479: Subscript #1 of the array COMPONENT has value 1 which is greater than the u
pper bound of 0
  PRINT *, a%component(1)
-----------^
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.

"-out:2014-11-24 len-param.exe"
-subsystem:console
-incremental:no
"2014-11-24 len-param.obj"
forrtl: severe (408): fort: (10): Subscript #1 of the array COMPONENT has value 1 which is greater than the upper bound
of 0

Image              PC                Routine            Line        Source
2014-11-24 len-pa  000000013FF86060  Unknown               Unknown  Unknown
2014-11-24 len-pa  000000013FF812A6  MAIN__                     11  2014-11-24 len-param.f90
2014-11-24 len-pa  000000013FFD58BE  Unknown               Unknown  Unknown
2014-11-24 len-pa  000000013FFBF493  Unknown               Unknown  Unknown
kernel32.dll       00000000777A59ED  Unknown               Unknown  Unknown
ntdll.dll          00000000778DC541  Unknown               Unknown  Unknown

 

0 Kudos
1 Reply
Steven_L_Intel1
Employee
375 Views

Thanks - escalated as issue DPD200363667. The compiler should not try to do compile-time bounds checking on things defined by a length parameter.

0 Kudos
Reply