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

Error: derived-types with fixed-sized array-components involving abstract interfaces

Hans_Peschke
Beginner
1,208 Views
Hi,
with ifort 11.1.064, the compilation of the following code results in a strange error message:
[plain]module cari
implicit none

integer, parameter :: prec = kind(0.0D0)

end module cari

module functions
use cari
implicit none

abstract interface
pure function mapping() result(res)
use cari
! real :: res !! works
real(prec) :: res !! error
! integer :: res !! error
end function mapping
end interface

type type_A
procedure(mapping), nopass, pointer :: f
real, dimension(0:2) :: xrange
end type

! the following code is not involved, but D is what I need ;-)
type type_B
type(type_A), dimension(0:2) :: D
end type

end module functions

program test
!use ...
implicit none

write(*,*) 'works'

end program test[/plain]
The error appearence depends on the type of the result of the abstract interface function, if the type e.g. is integer or real(prec) (with prec=kind(0.0D0)) then the following error occurs:
[plain]$ ifort -V ifort_error_proctype2.f90
Intel Fortran Compiler Professional for applications running on IA-32, Version 11.1 Build 20091130 Package ID: l_cprof_p_11.1.064
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
FOR NON-COMMERCIAL USE ONLY

Intel Fortran 11.1-2649
ifort_error_proctype2.f90(23): error #7821: The value of array bounds must be within 2**31-1 and -2**31.
real, dimension(0:2) :: xrange
------------------^
ifort_error_proctype2.f90(23): error #7821: The value of array bounds must be within 2**31-1 and -2**31.
real, dimension(0:2) :: xrange
--------------------^
ifort_error_proctype2.f90(28): error #7821: The value of array bounds must be within 2**31-1 and -2**31.
type(type_A), dimension(0:2) :: D
--------------------------^
ifort_error_proctype2.f90(28): error #7821: The value of array bounds must be within 2**31-1 and -2**31.
type(type_A), dimension(0:2) :: D
----------------------------^
compilation aborted for ifort_error_proctype2.f90 (code 1)
$
[/plain]
This is imo a wrongly error message, which should not appear.
If the type is default-real, then the error occurs not.

A very similar error appears in the following code:
[plain]module functions
implicit none

abstract interface
pure function mapping() result(res)
real :: res
end function mapping
end interface

type :: t1
real :: bv
integer :: y !!! error-switch !!!
end type

type :: type_A
!type(t1), dimension(0:2) :: a ! no problem
procedure(mapping), nopass, pointer :: f
end type

type :: type_B
real, dimension(1:4) :: xr2
type(type_A), dimension(0:2) :: D
end type
end module functions

program test
!use ...
implicit none

write(*,*) 'works'

end program test[/plain]
The error appears iff the derived type t1 has an integer component:
[cpp]$ ifort -V ifort_error_proctype.f90
Intel Fortran Compiler Professional for applications running on IA-32, Version 11.1 Build 20091130 Package ID: l_cprof_p_11.1.064
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
FOR NON-COMMERCIAL USE ONLY

Intel Fortran 11.1-2649
ifort_error_proctype.f90(21): error #7821: The value of array bounds must be within 2**31-1 and -2**31.
real, dimension(1:4) :: xr2
--------------------^
ifort_error_proctype.f90(21): error #7821: The value of array bounds must be within 2**31-1 and -2**31.
real, dimension(1:4) :: xr2
----------------------^
ifort_error_proctype.f90(22): error #7821: The value of array bounds must be within 2**31-1 and -2**31.
type(type_A), dimension(0:2) :: D
----------------------------^
ifort_error_proctype.f90(22): error #7821: The value of array bounds must be within 2**31-1 and -2**31.
type(type_A), dimension(0:2) :: D
------------------------------^
compilation aborted for ifort_error_proctype.f90 (code 1)
$
[/cpp]
Maybe there are several other circumstances in which this error appears.
Maybe this is related to http://software.intel.com/en-us/forums/showthread.php?t=70833

Best regards

Hans
0 Kudos
5 Replies
Steven_L_Intel1
Employee
1,210 Views
Thanks. we'll take a look.
0 Kudos
Steven_L_Intel1
Employee
1,210 Views
I don't think this is related to the other thread you pointed to, but one never knows. The key seems to be the declaration of a procedure pointer component of a derived type. This is corrupting the symbol table somehow so that any small perturbation can have odd effects.

You indicated that just "integer :: res" works, but it doesn't if "prec" is also declared in the local scope, even if it's not used. I'm guessing that this is really the same problem as this, which is fixed for Update 5, since it does compile ok with the latest inhouse compiler. I will ask the developers just to be sure. Issue ID is DPD200149020.
0 Kudos
Steven_L_Intel1
Employee
1,210 Views

The developers confirmed that this is the same issue and is already fixed for Update 5.
0 Kudos
Hans_Peschke
Beginner
1,210 Views

The developers confirmed that this is the same issue and is already fixed for Update 5.
Fine, Thanks Steve.
0 Kudos
Hans_Peschke
Beginner
1,210 Views

I only want to confirm, that the problem is solved with ifort 11.1.069


Many thanks


Hans

0 Kudos
Reply