<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/130531>130531</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] No compilation error when VALUE attribute is specified as anything other than a dummy argument
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang:frontend
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ohno-fj
</td>
</tr>
</table>
<pre>
```
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)
$
```
</pre>
<img width="1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