-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Closed
Labels
Description
flang-new
version is:flang-new version 20.0.0git (https://github.com/llvm/llvm-project.git bafe3a4b0ca0e9294a18a9ec4fea8567cb98dabe)
- Reduced test case:
! foo.f90
module foo
use iso_c_binding, only : c_ptr, c_null_ptr
implicit none
private
public :: foo_t
type :: foo_t
real(kind=4), dimension(:), contiguous, pointer :: buffer => null()
type(c_ptr) :: c_ptr = c_null_ptr
end type foo_t
contains
end module foo
! bar.f90
module bar
use foo, only : foo_t
implicit none
private
public :: bar_t
type :: bar_t
type(foo_t) :: buffer = foo_t()
end type bar_t
end module bar
! main.f90
program main
use bar
end program main
flang-new
invocation is:flang-new foo.f90 bar.f90 main.f90
- Expected behavior is: The code compiles successfully without errors.
- Actual behavior: Compilation fails with the following error:
bar.mod:9:47: error: Value in structure constructor of type 'REAL(4)' is incompatible with component 'c_ptr' of type 'c_ptr'
type(foo_t)::buffer=foo_t(buffer=NULL(),c_ptr=c_ptr(__address=0_8))
^^^^^^^^^^^^^^^^^^^^
foo.mod:12:14: Declaration of 'c_ptr'
type(c_ptr)::c_ptr=__builtin_c_ptr(__address=0_8)
^^^^^
bar.mod:9:53: error: Keyword '__address=' may not appear in a reference to a procedure with an implicit interface
type(foo_t)::buffer=foo_t(buffer=NULL(),c_ptr=c_ptr(__address=0_8))
^^^^^^^^^