You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[flang][intrinsic] restrict kind of get_command(_argument) to >= 2 (#139291)
Previously the following program would have failed with a runtime
assertion violation. This PR restricts the type information such that
this assertion failure isn't reachable. The example below demonstrates
the change.
```bash
$ cat error.f90
integer (kind=1) :: i
call get_command(length=i)
print *, i
end
$ cat good.f90
integer (kind=2) :: i
call get_command(length=i)
print *, i
end
$ prior/flang error.f90 && ./a.out
fatal Fortran runtime error(/home/akuhlenschmi/work/lorado/src/llvm-project/t.f90:2): Internal error: RUNTIME_CHECK(IsValidIntDescriptor(length)) failed at /home/akuhlenschmi/work/lorado/src/llvm-project/flang-rt/lib/runtime/command.cpp(154)
Aborted (core dumped)
$ prior/flang good.f90 && ./a.out
7
$ current/flang error.f90 && ./a.out
error: Semantic errors in t.f90
./t.f90:2:25: error: Actual argument for 'length=' has bad type or kind 'INTEGER(1)'
call get_command(length=i)
^
$ current/flang good.f90 && ./a.out
7
```
Also while making the change, I noticed that "get_command_argument"
suffers from the same issue, so I made a similar change for it.
0 commit comments