-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed as not planned
Closed as not planned
Copy link
Labels
flang:frontendquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
Description
Version of flang-new : 19.0.0(f2f9cdd22171f0c54cad7c6b183857f3d856c344)/AArch64
When source-expr of source specifier in allocate statement is the sum of two internal functions (SOURCE=(pptr() + pptr1())), a compilation-time error occurs.
When there is only one internal function (SOURCE=(pptr())), the compilation succeeds.
The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.
fe2_polymorphic_ut230_2.f90:
module mod1
type ty
integer(kind=4) :: num=1
end type ty
type, extends(ty):: ty1
integer(kind=8) :: num2=3
end type ty1
end module mod1
program main
use mod1
TYPE con
class(ty),POINTER::ptr
END TYPE con
INTERFACE OPERATOR(+)
function pls(a,b)
import ty1
import ty
class(ty), allocatable, intent(in) :: a
class(ty), allocatable, intent(in) :: b
type(ty1) :: pls
END function pls
END INTERFACE operator(+)
TYPE(con)::obj(10)
allocate(obj(1)%ptr,SOURCE=(pptr() + pptr1()))
if(obj(1)%ptr%num == 70) print*,'pass'
contains
function pptr()
class(ty),allocatable::pptr
allocate(pptr)
pptr%num = 30
end function pptr
function pptr1()
class(ty),allocatable::pptr1
allocate(pptr1)
pptr1%num = 40
end function pptr1
END program main
function pls(a,b)
use mod1
class(ty), allocatable, intent(in) :: a
class(ty), allocatable, intent(in) :: b
type(ty1) :: pls
pls%num = a%num + b%num
END function pls$ flang-new fe2_polymorphic_ut230_2.f90
error: Semantic errors in fe2_polymorphic_ut230_2.f90
./fe2_polymorphic_ut230_2.f90:25:31: error: No intrinsic or user-defined OPERATOR(+) matches operand types CLASS(ty) and CLASS(ty)
allocate(obj(1)%ptr,SOURCE=(pptr() + pptr1()))
^^^^^^^^^^^^^^^^
$
$ gfortran fe2_polymorphic_ut230_2.f90 ; ./a.out
pass
$
$ ifort -diag-disable=10448 fe2_polymorphic_ut230_2.f90
fe2_polymorphic_ut230_2.f90(25): error #9140: The allocatable result of a function reference may not be argument associated with an allocatable dummy argument. [PPTR]
allocate(obj(1)%ptr,SOURCE=(pptr() + pptr1()))
------------------------------^
fe2_polymorphic_ut230_2.f90(25): error #9140: The allocatable result of a function reference may not be argument associated with an allocatable dummy argument. [PPTR1]
allocate(obj(1)%ptr,SOURCE=(pptr() + pptr1()))
---------------------------------------^
compilation aborted for fe2_polymorphic_ut230_2.f90 (code 1)
$
Metadata
Metadata
Assignees
Labels
flang:frontendquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
Type
Projects
Status
Done