[all-commits] [llvm/llvm-project] 6f7a3b: [flang] Non-type-bound defined IO lowering

vdonaldson via All-commits all-commits at lists.llvm.org
Wed May 17 09:22:40 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6f7a3b078191a925546ea3fead2e9cf0efdd9257
      https://github.com/llvm/llvm-project/commit/6f7a3b078191a925546ea3fead2e9cf0efdd9257
  Author: V Donaldson <vdonaldson at nvidia.com>
  Date:   2023-05-17 (Wed, 17 May 2023)

  Changed paths:
    M flang/include/flang/Lower/AbstractConverter.h
    M flang/include/flang/Lower/Mangler.h
    M flang/include/flang/Optimizer/Support/InternalNames.h
    M flang/include/flang/Semantics/runtime-type-info.h
    M flang/lib/Lower/Bridge.cpp
    M flang/lib/Lower/IO.cpp
    M flang/lib/Lower/Mangler.cpp
    M flang/lib/Optimizer/Support/InternalNames.cpp
    M flang/lib/Semantics/runtime-type-info.cpp
    M flang/runtime/namelist.cpp
    M flang/runtime/non-tbp-dio.h
    M flang/test/Lower/derived-type-finalization.f90
    A flang/test/Lower/io-derived-type.f90
    M flang/test/Lower/namelist.f90
    M flang/test/Lower/parent-component.f90
    M flang/test/Lower/vector-subscript-io.f90

  Log Message:
  -----------
  [flang] Non-type-bound defined IO lowering

Generate supporting data structures and calls to new runtime IO functions
for defined IO that accesses non-type-bound procedures, such as `wft` in:

module m1
  type t
    integer n
  end type
  interface write(formatted)
    module procedure wft
  end interface
 contains
  subroutine wft(dtv, unit, iotype, v_list, iostat, iomsg)
    class(t), intent(in) :: dtv
    integer, intent(in) :: unit
    character(*), intent(in) :: iotype
    integer, intent(in) :: v_list(:)
    integer, intent(out) :: iostat
    character(*), intent(inout) :: iomsg
    iostat = 0
    write(unit,*,iostat=iostat,iomsg=iomsg) 'wft was called: ', dtv%n
  end subroutine
end module

module m2
 contains
  subroutine test1
    use m1
    print *, 'test1, should call wft: ', t(1)
  end subroutine
  subroutine test2
    use m1, only: t
    print *, 'test2, should not call wft: ', t(2)
  end subroutine
end module

use m1
use m2
call test1
call test2
print *, 'main, should call wft: ', t(3)
end




More information about the All-commits mailing list