Skip to content

Commit 4473356

Browse files
akuhlensgithub-actions[bot]
authored andcommitted
Automerge: [flang][semantics] ensure defined io dummies are not arrays. (#162744)
fixes [#162709](llvm/llvm-project#162709)
2 parents 9b1e9be + d70801b commit 4473356

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

flang/lib/Semantics/check-declarations.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3622,6 +3622,7 @@ void CheckHelper::CheckDioDtvArg(const Symbol &proc, const Symbol &subp,
36223622
ioKind == common::DefinedIo::ReadUnformatted
36233623
? Attr::INTENT_INOUT
36243624
: Attr::INTENT_IN);
3625+
CheckDioDummyIsScalar(subp, *arg);
36253626
}
36263627
}
36273628

@@ -3687,6 +3688,7 @@ void CheckHelper::CheckDioAssumedLenCharacterArg(const Symbol &subp,
36873688
"Dummy argument '%s' of a defined input/output procedure must be assumed-length CHARACTER of default kind"_err_en_US,
36883689
arg->name());
36893690
}
3691+
CheckDioDummyIsScalar(subp, *arg);
36903692
}
36913693
}
36923694

flang/test/Semantics/io11.f90

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,3 +809,24 @@ subroutine wf(dtv, unit, iotype, v_list, iostat, iomsg)
809809
end
810810
end interface
811811
end
812+
813+
module m30
814+
type base
815+
character(5), allocatable :: data
816+
end type
817+
interface write(formatted)
818+
subroutine formattedRead (dtv, unit, iotype, v_list, iostat, iomsg)
819+
import base
820+
!ERROR: Dummy argument 'dtv' of a defined input/output procedure must be a scalar
821+
class (base), intent(in) :: dtv(10)
822+
integer, intent(in) :: unit
823+
!ERROR: Dummy argument 'iotype' of a defined input/output procedure must be a scalar
824+
character(*), intent(in) :: iotype(2)
825+
integer, intent(in) :: v_list(:)
826+
!ERROR: Dummy argument 'iostat' of a defined input/output procedure must be a scalar
827+
integer, intent(out) :: iostat(*)
828+
!ERROR: Dummy argument 'iomsg' of a defined input/output procedure must be a scalar
829+
character(*), intent(inout) :: iomsg(:)
830+
end subroutine
831+
end interface
832+
end module

0 commit comments

Comments
 (0)