Quantcast
Channel: Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2583

pointer value function return, contiguous, ifort 18.0, bug??

$
0
0

Hi there.

This code:

Module Test_Parent
  Type, abstract :: Parent
  contains
    Procedure(FunGetPt), Pass, Deferred :: getPt
  End type Parent
  Abstract Interface
    Function FunGetPt(this)
      Import parent
      Class(parent), Intent(In), Target :: this
      Real, Pointer :: FunGetPt(:,:)
    End Function FunGetPt
  End Interface
  Type, extends(parent) :: Progeny
    Real, allocatable :: a(:,:)
  contains
    Procedure, Pass :: getPt => FunGetPt_Pr
  End type Progeny
contains
  Function FunGetPt_Pr(this)
    Class(progeny), Intent(In), Target :: this
    Real, Pointer :: FunGetPt_Pr(:,:)
    FunGetPt_Pr=>this%a
  End Function FunGetPt_Pr
End Module Test_Parent
Program PP
  use Test_Parent, only: progeny
  Implicit None
  Type(progeny), Target :: a
  Real, Pointer, contiguous :: b(:,:)=>null()
  allocate(a%a(10,10),source=10.0)
  b=>a%getPt()
End Program PP

yields

Test.f90(31): error #5558: A pointer with the CONTIGUOUS attributes is being made to a non-contiguous target
  b=>a%getPt()
--^
compilation aborted for Test.f90 (code 1)

when compiled with 18.0 and

ifort -o0 -check all Test.f90

It runs when using 17.4.

Is that a Bug??

Cheers


Viewing all articles
Browse latest Browse all 2583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>