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

Structure constructor with pointer component silliness

IanH
Honored Contributor III
621 Views

The compiler complains that the component spec in the structure constructor is not of the same type and kind as the component.  But it is... isn't it?

 

MODULE m
  IMPLICIT NONE
  
  TYPE, PUBLIC :: NodeRef
    TYPE(Node), POINTER :: item => NULL()
  END TYPE NodeRef
  
  TYPE, PUBLIC :: Node
    TYPE(NodeRef), ALLOCATABLE :: upstream(:)
  END TYPE Node
CONTAINS
  SUBROUTINE s(self)
    TYPE(Node), INTENT(INOUT), TARGET :: self
    self%upstream = [NodeRef(self)]
  END SUBROUTINE s
END MODULE m

 

 

>ifort /c /check:all /warn:all /standard-semantics "2015-09-24 nodes.f90"
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0 Build 20150815
Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.

2015-09-24 nodes.f90(17): error #6795: The target must be of the same type and kind type parameters as the pointer.   [SELF]
    self%upstream = [NodeRef(self)]
-----------------------------^
compilation aborted for 2015-09-24 nodes.f90 (code 1)

 

0 Kudos
1 Reply
Yuan_C_Intel
Employee
621 Views

Hi, IanH

Yes, you are correct. This is a known issue in compiler. You may find a similar discussion before:

http://software.intel.com/en-us/forums/topic/375845

I have added your case in our existing record DPD200248768. We will let you know if any update.

Thanks

0 Kudos
Reply