Issue |
130531
|
Summary |
[Flang] No compilation error when VALUE attribute is specified as anything other than a dummy argument
|
Labels |
flang:frontend
|
Assignees |
|
Reporter |
ohno-fj
|
```
Version of flang : 21.0.0(8c7c791284877e36f73c41ffa56b52c13e613993)/AArch64
```
The attached program is incorrect.
When `VALUE attribute` is specified as anything other than a dummy argument, a warning level message is outputted, but no compilation error occurs.
According to `Fortran Standard 2023: 8.5.19 VALUE attribute`, `VALUE attribute` can only be specified for a dummy argument.
Shouldn't the above be a compilation error?
Gfortran and ifx results in compilation errors.
The following are the test program, Flang, Gfortran and ifx compilation/execution result.
snes1105e_006_2.f90:
```fortran
module mod1
value :: val0
end module mod1
program main
integer val0
end program main
subroutine sub1(mod1)
use mod1
value :: mod1
end subroutine sub1
```
```
$ flang snes1105e_006_2.f90; ./a.out
./snes1105e_006_2.f90:2:12: warning: Only a dummy argument should have an INTENT, VALUE, or OPTIONAL attribute
value :: val0
^^^^
$
```
```
$ gfortran snes1105e_006_2.f90
snes1105e_006_2.f90:2:15:
2 | value :: val0
| 1
Error: 'val0' at (1) cannot have the VALUE attribute because it is not a dummy argument
snes1105e_006_2.f90:10:7:
10 | use mod1
| 1
Fatal Error: Cannot open module file 'mod1.mod' for reading at (1): No such file or directory
compilation terminated.
$
```
```
$ ifx snes1105e_006_2.f90
snes1105e_006_2.f90(2): error #6445: A dummy argument is required in this context. [VAL0]
value :: val0
-----------^
snes1105e_006_2.f90(2): error #6274: This statement must not appear in the specification part of a module.
value :: val0
--^
snes1105e_006_2.f90(10): error #6412: A dummy argument name is invalid in this context. [MOD1]
use mod1
------^
compilation aborted for snes1105e_006_2.f90 (code 1)
$
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs