<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/131548>131548</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Flang] Preprocessor does not work correctly in int-literal-constant
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang
      </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(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
$
```


</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUlVFvqzgThn_N5GYEMmMIcMEFX9t82ouVKu1q97IyYBKfGjuyTU_771cmtJsmOed0o0ghMMy8zztjW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