Issue |
131548
|
Summary |
[Flang] Preprocessor does not work correctly in int-literal-constant
|
Labels |
flang
|
Assignees |
|
Reporter |
ohno-fj
|
```
Version of flang : 21.0.0(74ca5799caea342ac1e8d34ab5be7f45875131b2)/AArch64
```
Preprocessor does not work correctly in `int-literal-constant`.
When I look at the file (`snggo785_2.i`) processed by the preprocessor, lines 3 is processed correctly, but line 4 is not.
The following line:
```
print *,1_n
```
Expect to translate as follows
```
print *,1_k
```
The following are the test program, Flang, Gfortran and ifx compilation/execution result.
snggo783_2.F90:
```fortran
program main
#define n k
parameter(n=4)
print *,1_n
end program main
```
```
$ flang snggo783_2.F90 -save-temps
error: Semantic errors in snggo783_2.i
./snggo783_2.F90:4:17: error: Parameter 'n' not found
print *,1_n
^
$
$ cat snggo783_2.i
#line "./snggo783_2.F90" 1
program main
parameter(k=4)
print *,1_n
end program main
$
```
```
$ gfortran snggo783_2.F90 -save-temps
snggo783_2.F90:4:13:
4 | print *,1_n
| 1
Error: Missing kind-parameter at (1)
$
$ cat a-snggo783_2.f90
# 1 "snggo783_2.F90"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "snggo783_2.F90"
program main
parameter(k=4)
print *,1_n
end program main
$
```
```
$ ifx snggo783_2.F90 -P
$
$ cat snggo783_2.i90
# 1 "snggo783_2.F90"
program main
parameter(k=4)
print *,1_k
end program main
$
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs