- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the code below, results of size of list variable are confused(Some of them are equal to 1). If each buffer within the write statement is replaced with exactly the according constant string, resullts would be reasonable(All are 0). Why's that ? Thanks for any help.
module test1
implicit none
private
public :: tp1
type :: tp1
private
! <nothing.>
contains
private
generic, public :: write(formatted) => formattedwritesub
procedure, pass :: formattedwritesub
end type tp1
contains
recursive subroutine formattedwritesub(var, unit, type, list, iostat, iomsg)
class(tp1), intent(in) :: var
integer, intent(in) :: unit
character(*), intent(in) :: type
integer, dimension(:), intent(in) :: list
integer, intent(out) :: iostat
character(*), intent(inout) :: iomsg
character(:), allocatable :: buffer
IF(type == "DTString")then
write(*,*) "Size of list in DTString is: ", SIZE(list)
buffer = "(DT'String1')"
write(*,buffer) var
else IF(type == "DTString1")then
write(*,*) "Size of list in DTString1 is: ", SIZE(list)
buffer = "(DT'String2')"
write(*,buffer) var
else IF(type == "DTString2")then
write(*,*) "Size of list in DTString2 is: ", SIZE(list)
buffer = "(DT'String3')"
write(*,buffer) var
else IF(type == "DTString3")then
write(*,*) "Size of list in DTString3 is: ", SIZE(list)
end if
end subroutine formattedwritesub
end module test1
program main
use test1
type(tp1) :: var
write(*,"(DT'String')") var
end program main
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think this is a bug in the Fortran run-time related to processing of a format that is a variable. You are correct that the size of LIST should be zero in all cases. Please report this through the Intel Online Service Center.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve Lionel (Ret.) wrote:I think this is a bug in the Fortran run-time related to processing of a format that is a variable. You are correct that the size of LIST should be zero in all cases. Please report this through the Intel Online Service Center.
Thanks Steve, I'll report it later.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page