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

Regression in 19.0: intrinsic assignment of a DT involving LHS allocation fails if a component DT includes defined assignment

FortranFan
Honored Contributor III
354 Views

Shown below is a minimal reproducer of an issue extracted from another thread.  It works as expected using Intel Fortran 18.0 update 3:  A support request has been submitted with Intel.

module m
   type :: a
      integer :: i = 0
   end type
   type :: b
      integer, allocatable :: j(:)
   contains
      procedure :: assign_b
      generic :: assignment(=) => assign_b !<-- Comment this line and this test works 
   end type
   type :: c
      type(a) :: foo
      type(b) :: bar
   end type
contains
   elemental subroutine assign_b( lhs, rhs )
      class(b), intent(inout) :: lhs
      type(b), intent(in)     :: rhs
   end subroutine
end module m
   use m, only : c
   type(c) :: x(2)
   type(c), allocatable :: y(:)
   x%foo%i = [ 1, 2 ]
   y = x
   print *, "y%foo%i = ", y%foo%i, "; expected = ", x%foo%i
   if ( any(y%foo%i /= x%foo%i) ) stop "FAILURE"
   stop "SUCCESS"
end

With 19.0 release,

C:\Temp>ifort /standard-semantics p.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R
) 64, Version 19.0.0.117 Build 20180804
Copyright (C) 1985-2018 Intel Corporation. All rights reserved.

Microsoft (R) Incremental Linker Version 14.14.26433.0
Copyright (C) Microsoft Corporation. All rights reserved.

-out:p.exe
-subsystem:console
p.obj

C:\Temp>p.exe
y%foo%i = 2 6226020 ; expected = 1 2
FAILURE

C:\Temp>

 

0 Kudos
0 Replies
Reply