Index: flang/lib/Lower/IO.cpp =================================================================== --- flang/lib/Lower/IO.cpp +++ flang/lib/Lower/IO.cpp @@ -99,7 +99,7 @@ mkIOKey(SetFile), mkIOKey(GetNewUnit), mkIOKey(GetSize), mkIOKey(GetIoLength), mkIOKey(GetIoMsg), mkIOKey(InquireCharacter), mkIOKey(InquireLogical), mkIOKey(InquirePendingId), - mkIOKey(InquireInteger64), mkIOKey(EndIoStatement)> + mkIOKey(InquireInteger64), mkIOKey(EndIoStatement), mkIOKey(SetConvert)> newIOTable; } // namespace Fortran::lower @@ -983,7 +983,8 @@ ioFunc = getIORuntimeFunc(loc, builder); break; case Fortran::parser::ConnectSpec::CharExpr::Kind::Convert: - TODO(loc, "CONVERT not part of the runtime::io interface"); + ioFunc = getIORuntimeFunc(loc, builder); + break; case Fortran::parser::ConnectSpec::CharExpr::Kind::Dispose: TODO(loc, "DISPOSE not part of the runtime::io interface"); } Index: flang/test/Lower/io-statement-open-options.f90 =================================================================== --- /dev/null +++ flang/test/Lower/io-statement-open-options.f90 @@ -0,0 +1,12 @@ +! Test lowering of OPEN statment options +! RUN: bbc %s -emit-fir -o - | FileCheck %s + +! CHECK-LABEL: func.func @_QPtest_convert_specifier( +subroutine test_convert_specifier(unit) + integer :: unit + ! CHECK: %[[cookie:.*]] = fir.call @_FortranAioBeginOpenUnit(%{{.*}}, %{{.*}}, %{{.*}}) : (i32, !fir.ref, i32) -> !fir.ref + ! CHECK: %{{.*}} = fir.call @_FortranAioSetConvert(%[[cookie]], %{{.*}}, %{{.*}}) : (!fir.ref, !fir.ref, i64) -> i1 + ! CHECK: %{{.*}} = fir.call @_FortranAioEndIoStatement(%[[cookie]]) : (!fir.ref) -> i32 + open(unit, form="UNFORMATTED", convert="BIG_ENDIAN") + close(unit) +end subroutine