@@ -451,39 +451,42 @@ RT_API_ATTRS int DescriptorIoTicket<DIR>::Begin(WorkQueue &workQueue) {
451
451
if (const typeInfo::DerivedType *type{
452
452
addendum ? addendum->derivedType () : nullptr }) {
453
453
// derived type unformatted I/O
454
- if (table_) {
455
- if (const auto *definedIo{table_->Find (*type,
456
- DIR == Direction::Input
457
- ? common::DefinedIo::ReadUnformatted
458
- : common::DefinedIo::WriteUnformatted)}) {
459
- if (definedIo->subroutine ) {
460
- typeInfo::SpecialBinding special{DIR == Direction::Input
461
- ? typeInfo::SpecialBinding::Which::ReadUnformatted
462
- : typeInfo::SpecialBinding::Which::WriteUnformatted,
463
- definedIo->subroutine , definedIo->isDtvArgPolymorphic , false ,
464
- false };
465
- if (DefinedUnformattedIo (io_, instance_, *type, special)) {
466
- anyIoTookPlace_ = true ;
467
- return StatOk;
454
+ if (DIR == Direction::Input || !io_.get_if <InquireIOLengthState>()) {
455
+ if (table_) {
456
+ if (const auto *definedIo{table_->Find (*type,
457
+ DIR == Direction::Input
458
+ ? common::DefinedIo::ReadUnformatted
459
+ : common::DefinedIo::WriteUnformatted)}) {
460
+ if (definedIo->subroutine ) {
461
+ typeInfo::SpecialBinding special{DIR == Direction::Input
462
+ ? typeInfo::SpecialBinding::Which::ReadUnformatted
463
+ : typeInfo::SpecialBinding::Which::WriteUnformatted,
464
+ definedIo->subroutine , definedIo->isDtvArgPolymorphic , false ,
465
+ false };
466
+ if (DefinedUnformattedIo (io_, instance_, *type, special)) {
467
+ anyIoTookPlace_ = true ;
468
+ return StatOk;
469
+ }
470
+ } else {
471
+ int status{workQueue.BeginDerivedIo <DIR>(
472
+ io_, instance_, *type, table_, anyIoTookPlace_)};
473
+ return status == StatContinue ? StatOk : status; // done here
468
474
}
469
- } else {
470
- int status{workQueue.BeginDerivedIo <DIR>(
471
- io_, instance_, *type, table_, anyIoTookPlace_)};
472
- return status == StatContinue ? StatOk : status; // done here
473
475
}
474
476
}
475
- }
476
- if (const typeInfo::SpecialBinding *special{
477
- type->FindSpecialBinding (DIR == Direction::Input
478
- ? typeInfo::SpecialBinding::Which::ReadUnformatted
479
- : typeInfo::SpecialBinding::Which::WriteUnformatted)}) {
480
- if (!table_ || !table_->ignoreNonTbpEntries || special->IsTypeBound ()) {
481
- // defined derived type unformatted I/O
482
- if (DefinedUnformattedIo (io_, instance_, *type, *special)) {
483
- anyIoTookPlace_ = true ;
484
- return StatOk;
485
- } else {
486
- return IostatEnd;
477
+ if (const typeInfo::SpecialBinding *special{
478
+ type->FindSpecialBinding (DIR == Direction::Input
479
+ ? typeInfo::SpecialBinding::Which::ReadUnformatted
480
+ : typeInfo::SpecialBinding::Which::WriteUnformatted)}) {
481
+ if (!table_ || !table_->ignoreNonTbpEntries ||
482
+ special->IsTypeBound ()) {
483
+ // defined derived type unformatted I/O
484
+ if (DefinedUnformattedIo (io_, instance_, *type, *special)) {
485
+ anyIoTookPlace_ = true ;
486
+ return StatOk;
487
+ } else {
488
+ return IostatEnd;
489
+ }
487
490
}
488
491
}
489
492
}
0 commit comments