[all-commits] [llvm/llvm-project] 82982d: [flang][intrinsic] restrict kind of get_command(_a...
Andre Kuhlenschmidt via All-commits
all-commits at lists.llvm.org
Fri May 9 17:21:00 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 82982d74e75a7f304009263486ab1f698cc94229
https://github.com/llvm/llvm-project/commit/82982d74e75a7f304009263486ab1f698cc94229
Author: Andre Kuhlenschmidt <andre.kuhlenschmidt at gmail.com>
Date: 2025-05-09 (Fri, 09 May 2025)
Changed paths:
M flang/lib/Evaluate/intrinsics.cpp
A flang/test/Semantics/command.f90
Log Message:
-----------
[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.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list