8000 Handle str slice as read variable · Issue #7084 · lfortran/lfortran · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Handle str slice as read variable #7084
Open
@jinangshah21

Description

@jinangshah21

MRE:

program write_and_read_temp
    character(len=20) :: buf
    integer(8) :: stat, major, temp = 1
    character(len=20) :: filename

    filename = "tempfile.txt"

    open(unit=10, file=filename, status='replace', access="stream", form="unformatted")

    write(10) "HELLOWORLD"
    close(10)
    open(unit=10, file=filename, status='old', access="stream", form="unformatted")
    major = 2   ! Try changing this to 1

    read(10, iostat=stat) buf(1:merge(4, 2, major > 1))

    print *, "Status code:", stat
    print *, "From file:", trim(buf)

    close(10, status="delete")
end program write_and_read_temp

lfortran error:

lfortran: /home/jinang_shah/conda_root/envs/lf/include/llvm/IR/Instructions.h:1181: void llvm::ICmpInst::AssertOK(): Assertion `getOperand(0)->getType() == getOperand(1)->getType() && "Both operands to ICmp instruction are not of the same type!"' failed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibIssues related to compiling fortran-lang/stdlibstringsAny bug related to strings

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0