Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
5 Views

Problems with parameterized derived types

Windows 10 Pro Build 14393
MS visual studio ultimate 2013 12.0.40629.00 Update 5
Intel(R) Visual Fortran Compiler XE 15.0.7.287

Type :: Grid1D(Nx,Ns)
                        Integer(4),Len :: Nx=100,Ns=1_4
                        Real(8) ::  SS(1:Nx,1:Ns)
                        Integer(4) :: NxA=1,NyA=1
End Type

(1) Sometimes it will not compile but sometimes it is correctly complied.

Error massage: error #8737: For a default initialized component every type parameter and array bound must be a constant expression.   [SS]

Adding a useless code before it will solve the problem

              Type :: Test
                        Real(8), Allocatable :: Test2(:)
              End Type

 

(2) If it is complied, some of the component can not be referred when compiling

 Error massage: error #6460: This is not a field name that is defined in the encompassing structure.   [NYA] 

This happens when the Subroutine below is compiled (The code has been cleaned).

Subroutine  DiagHeatingRatePeriod(GD)
         Implicit none
         Class(*),intent(inout)  :: GD
         Select Type (GD)
                Type is (Grid1D(*,*))
                    GD%Nya=1
         End select
        Return    
End Subroutine

 

Thanks!

0 Kudos
12 Replies
Highlighted
5 Views

You'll need to provide a

You'll need to provide a complete compilable source for us to look at. Also, please try a current compiler version (17.0.0 is current.) We've fixed a lot of bugs since 15.0.

Retired 12/31/2016
0 Kudos
Highlighted
Beginner
5 Views

Windows 10 Pro Build 14393

Windows 10 Pro Build 14393
MS visual studio 14.0.25431.01 Update 3 (same problems with MS visual studio ultimate 2013 12.0.40629.00 Update 5)

Test Case A: Constant2.F90  complie with 2015/2016/2017 with errors

------ Build started: Project: Test, Configuration: Debug|Win32 ------

Compiling with Intel(R) Visual Fortran Compiler 17.0.0.109 [IA-32]...
Constant2.F90
fortcom: Fatal: There has been an internal compiler error (C0000005).
compilation aborted for C:\Users\Tame\Source\Repos\PM\Test\Test\Constant2.F90 (code 1)

Build log written to  "file://C:\Users\Tame\Source\Repos\PM\Test\Test\Debug\BuildLog.htm"
Test - 1 error(s), 0 warning(s)


---------------------- Done ----------------------


------ Build started: Project: Test, Configuration: Debug|Win32 ------

Compiling with Intel(R) Visual Fortran Compiler 16.0.4.246 [IA-32]...
Constant2.F90
fortcom: Fatal: There has been an internal compiler error (C0000005).
compilation aborted for C:\Users\Tame\Source\Repos\PM\Test\Test\Constant2.F90 (code 1)

Build log written to  "file://C:\Users\Tame\Source\Repos\PM\Test\Test\Debug\BuildLog.htm"
Test - 1 error(s), 0 warning(s)


---------------------- Done ----------------------


------ Build started: Project: Test, Configuration: Debug|Win32 ------

Compiling with Intel(R) Visual Fortran Compiler XE 15.0.7.287 [IA-32]...
Constant2.F90
C:\Users\Tame\Source\Repos\PM\Test\Test\Constant2.F90(53): error #8737: For a default initialized component every type parameter and array bound must be a constant expression.   [VALUE]
C:\Users\Tame\Source\Repos\PM\Test\Test\Constant2.F90(61): error #8737: For a default initialized component every type parameter and array bound must be a constant expression.   [VALUE]
compilation aborted for C:\Users\Tame\Source\Repos\PM\Test\Test\Constant2.F90 (code 1)

Build log written to  "file://C:\Users\Tame\Source\Repos\PM\Test\Test\Debug\BuildLog.htm"
Test - 3 error(s), 0 warning(s)


Test Case B: Constant2.F90  complie with 2015/2016/2017 with no errors simplly by adding or removing something, the error is not always reproducibale

Here the error dissapeared in 2016/2017, but still exited in 2015 by remove 
"              
               Type :: Test2
                        Real(8), Allocatable :: Test2(:)
              End Type
"

------ Build started: Project: Test, Configuration: Debug|Win32 ------

Compiling with Intel(R) Visual Fortran Compiler 17.0.0.109 [IA-32]...
Constant3.F90

Build log written to  "file://C:\Users\Tame\Source\Repos\PM\Test\Test\Debug\BuildLog.htm"
Test - 0 error(s), 0 warning(s)


---------------------- Done ----------------------
------ Build started: Project: Test, Configuration: Debug|Win32 ------

Compiling with Intel(R) Visual Fortran Compiler 16.0.4.246 [IA-32]...
Constant3.F90

Build log written to  "file://C:\Users\Tame\Source\Repos\PM\Test\Test\Debug\BuildLog.htm"
Test - 0 error(s), 0 warning(s)


---------------------- Done ----------------------

------ Build started: Project: Test, Configuration: Debug|Win32 ------

Compiling with Intel(R) Visual Fortran Compiler XE 15.0.7.287 [IA-32]...
Constant3.F90
C:\Users\Tame\Source\Repos\PM\Test\Test\Constant3.F90(58): error #8737: For a default initialized component every type parameter and array bound must be a constant expression.   [VALUE]
compilation aborted for C:\Users\Tame\Source\Repos\PM\Test\Test\Constant3.F90 (code 1)

Build log written to  "file://C:\Users\Tame\Source\Repos\PM\Test\Test\Debug\BuildLog.htm"
Test - 2 error(s), 0 warning(s)


---------------------- Done ----------------------

Compiling with Intel(R) Visual Fortran Compiler XE 15.0.7.287 [IA-32]...
ifort /nologo /debug:full /Od /warn:interfaces /module:"Debug\\" /object:"Debug\\" /Fd"Debug\vc140.pdb" /traceback /check:bounds /check:stack /libs:dll /threads /dbglibs /c /Qvc14 /Qlocation,link,"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\\bin" "C:\Users\Tame\Source\Repos\PM\Test\Test\Constant3.F90"
C:\Users\Tame\Source\Repos\PM\Test\Test\Constant3.F90(58): error #8737: For a default initialized component every type parameter and array bound must be a constant expression.   [VALUE]
              End Type Grid1D
^
compilation aborted for C:\Users\Tame\Source\Repos\PM\Test\Test\Constant3.F90 (code 1)


Test - 2 error(s), 0 warning(s)

 

0 Kudos
Highlighted
Black Belt
5 Views

Oddly, if the /Od option is

Oddly, if the /Od option is removed, the two files can be compiled without encountering the ICE.

0 Kudos
Highlighted
Beginner
5 Views

The problem is no always

The problem is no always reproducible. It is really annoying when trying to use parameterized derived types.

Sometimes even by adding some blank lines will remove the problem. 

I guess the reason is the compiler does not always compile parameterized derived types with F2003 standard by sometimes with F95 standard.

Adding some meaningless lines will avoid the problem sometimes.

 

mecej4 wrote:

Oddly, if the /Od option is removed, the two files can be compiled without encountering the ICE.

0 Kudos
Highlighted
Valued Contributor III
5 Views

Quote:Steve Lionel (Intel)

Steve Lionel (Intel) wrote:

.. please try a current compiler version (17.0.0 is current.) We've fixed a lot of bugs since 15.0.

Steve,

Fyi for Intel development team: I tried version 17.0.0.109 [Intel(R) 64] with the Constant2.F90 file posted by Wei J. in Message #3 and I get ICEs with /Od as well as with /On (n=1 to 3) options.  The behavior is indeed as indicated by OP and noticed previously with other ICEs; a slight change of source file can prevent or reintroduce the ICE, e.g., removing the module named Constants helped compile the code successfully in one instance, or removing the PDT Grid2D compiled ok too.

I can attest to OP's comment, "It is really annoying when trying to use parameterized derived types." but, as I've stated previously, that's not too say PDT's should not be supported in the standard - I find PDTs to be a very useful concept and if anything, I would like to see the feature extended considerably to provide greater support for generics in Fortran.  Rather it will be most useful if Intel Fortran team can step back and take a comprehensive look at the PDT implementation to clean, thorough resolutions quickly to the outstanding issues and get it the functionality working right overall for users.  My confidence level in using the facility in my own code designs or to recommend to other colleagues remains low as I'm really struggling to keep track of what has been fixed since 15.0 - it's proving too difficult to get a big picture on PDTs and to understand what's been resolved and what issues still pending with PDTs in Intel Fortran, the problem being further compounded with the missing "compiler fixes list" with 17.0 version.  It's all rather frustrating.

Thanks, 

 

0 Kudos
Highlighted
5 Views

There's an effort to restore

There's an effort to restore the fixes list in some form, but it probably wouldn't be useful if just trying to match symptoms.

Thanks for the complete example - we'll get right on it. PDT LEN parameters are difficult to get right.

Retired 12/31/2016
0 Kudos
Highlighted
5 Views

I haven't been able to

I haven't been able to reproduce it yet. Will keep trying.

Retired 12/31/2016
0 Kudos
Highlighted
5 Views

I can now reproduce an error

I can now reproduce an error but only with an x64 target compile. It doesn't reproduce in a later internal build, so I am testing it with the upcoming Update 1 to see what happens.

Grr.. and now I can reproduce it in Win32 as well. You're right, this is variable! We'll get to the bottom of it.

Retired 12/31/2016
0 Kudos
Highlighted
Valued Contributor III
5 Views

Quote:Steve Lionel (Intel)

Steve Lionel (Intel) wrote:

.. You're right, this is variable! We'll get to the bottom of it.

Steve,

FWIW, here's what I had found from a 10 minute look at the code yesterday - please see comments marked with !** in the reduced example below, all with x64 target (Intel(R) 64 compiler version):

module Constants

   implicit none
   
   real(8) :: R  !** 1)  Commenting out this line avoids ICE, but triggers unexpected error #8737

contains

   subroutine DRandomInt(RR)  !** 2) OR Commenting out this procedure avoids ICE
   
      use IFPORT
   
      real(8),intent(inout) :: RR
   
      integer :: AA
      AA=int(RR*100.d0)
      RR=DRAND(AA)
      return
      
      entry  DRandom(RR)     !**  3) OR Commenting out this ENTRY section avoids ICE with /On (n=1 to 3), not /Od
      RR=DRAND(0)            !
   
      return
   
   end subroutine DRandomInt

end module Constants

module TypeModule

   implicit none

   !  This Section is the definitions of the physicla parameters.

   integer(4),parameter :: NxMax=65

   type :: Grid2D(Nx,Ny,Ns)
      integer(4),len :: Nx=NxMax,Ny=1000,Ns=1_4
      real(8) ::  value(1:Nx,0:Ny,1:Ns)    !**    4) OR Commenting out this line avoids ICE
      real(8) :: Dx=0.d0,Dy=0.d0
      integer(4) :: timer=0,Period=1
   end type Grid2D

end module TypeModule

 

0 Kudos
Highlighted
5 Views

Based on my experiments with

Based on my experiments with a "release candidate" build of Update 1, I am 99% certain that the bugs related to these sources (including FortranFan's cut-down version) will be fixed with Update 1. I'm expecting this to be released "soon", but it has taken longer to get it out than we anticipated. When you do get Update 1, please try it on your whole application and let us know how it works for you.

Retired 12/31/2016
0 Kudos
Highlighted
Beginner
5 Views

Steve and FortranFan, thanks

Steve and FortranFan, thanks a lot for the help

0 Kudos
Highlighted
5 Views

Update 1 should be available

Update 1 should be available later today.

Retired 12/31/2016
0 Kudos