llvm-capstone/flang/test
Yi Wu a2d4a4c0b2 Apply kind code check on exitstat and cmdstat (#78286)
When testing on gcc, both exitstat and cmdstat must be a kind=4 integer,
e.g. DefaultInt. This patch changes the input arg requirement from
`AnyInt` to `TypePattern{IntType, KindCode::greaterOrEqualToKind, n}`.

The standard stated in 16.9.73
- EXITSTAT (optional) shall be a scalar of type integer with a decimal
exponent range of at least nine.
- CMDSTAT (optional) shall be a scalar of type integer with a decimal
exponent range of at least four.

```fortran
program bug
  implicit none
  integer(kind = 2) :: exitstatvar
  integer(kind = 4) :: cmdstatvar
  character(len=256) :: msg
  character(len=:), allocatable :: command
  command='echo hello'
  call execute_command_line(command, exitstat=exitstatvar, cmdstat=cmdstatvar)
end program
```
When testing the above program with exitstatvar kind<4, an error would
occur:
```
$ ../build-release/bin/flang-new test.f90
error: Semantic errors in test.f90
./test.f90:8:47: error: Actual argument for 'exitstat=' has bad type or kind 'INTEGER(2)'
    call execute_command_line(command, exitstat=exitstatvar)
```

When testing the above program with exitstatvar kind<2, an error would
occur:
```
$ ../build-release/bin/flang-new test.f90
error: Semantic errors in test.f90
./test.f90:8:47: error: Actual argument for 'cmdstat=' has bad type or kind 'INTEGER(1)'
    call execute_command_line(command, cmdstat=cmdstatvar)
```

Test file for this semantics has been added to `flang/test/Semantic`
Fixes: https://github.com/llvm/llvm-project/issues/77990

(cherry picked from commit 14a15103cc9dbdb3e95c04627e0b96b5e3aa4944)
2024-01-30 16:45:35 +00:00
..
Analysis/AliasAnalysis [flang][hlfir] Make alias analysis trace through box designators. (#67353) 2023-09-25 11:27:28 -07:00
Driver [AMDGPU] Change default AMDHSA Code Object version to 5 (#79038) 2024-01-23 17:08:18 +05:30
Evaluate [flang][runtime] Better real MOD/MODULO results (#77167) 2024-01-15 11:48:36 -08:00
Examples [flang] Remove test from #69121 to fix gcc build with gcc < 10.0 2023-10-20 10:13:04 +02:00
Fir [Flang][MLIR][OpenMP] Remove the early outlining interface (#78450) 2024-01-18 15:33:43 +00:00
HLFIR [flang] fix unsafe memory access using mlir::ValueRange (#78435) 2024-01-18 10:17:53 -05:00
Integration [Flang] Add new Integration tests directory to Flang (#73141) 2023-11-24 16:02:39 +00:00
Intrinsics [flang] Add comdats to functions with linkonce linkage (#66516) 2023-09-19 15:00:04 +01:00
lib [flang] CUDA Fortran - part 1/5: parsing 2023-05-31 09:48:59 -07:00
Lower fix optional wait wrongly treated as false (#78149) 2024-01-23 10:05:42 +00:00
NonGtestUnit [NFC][Py Reformat] Reformat python files in the rest of the dirs 2023-05-25 11:17:05 +02:00
Parser [flang] Accept multiple spaces after compiler directive sentinel (#76541) 2024-01-02 09:15:04 -08:00
Preprocessing [flang][driver] Add support for -isysroot in the frontend (#77365) 2024-01-11 10:37:58 -03:00
Runtime [flang] add no-cpp-dep test for AIX 64 bit (#74637) 2023-12-21 08:58:55 -05:00
Semantics Apply kind code check on exitstat and cmdstat (#78286) 2024-01-30 16:45:35 +00:00
Transforms [Flang] Fix for replacing loop uses in LoopVersioning pass (#77899) 2024-01-20 22:16:05 +00:00
Unit [NFC][Py Reformat] Reformat python files in the rest of the dirs 2023-05-25 11:17:05 +02:00
CMakeLists.txt Revert "[Flang] [FlangRT] Introduce FlangRT project as solution to Flang's runtime LLVM integration" 2023-10-02 09:02:05 +00:00
lit.cfg.py [flang][driver] Fix Driver/isysroot.f90 test (#78478) 2024-01-18 11:21:57 -03:00
lit.site.cfg.py.in [flang][driver] Fix Driver/isysroot.f90 test (#78478) 2024-01-18 11:21:57 -03:00