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

    <tr>
        <th>Summary</th>
        <td>
            [Flang] Preprocessor error when the name to be replaced contains trailing blank in a continuation line
        </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-new : 20.0.0(675c748bb606d75a959481e6014299849cf3094c)/AArch64
```

When building [elpa](http://elpa.mpcdf.mpg.de/), the preprocessor does not work correctly.  
When the name to be replaced contains trailing blank in a continuation line, the preprocessor does not replace that name correctly. 
When it does not contain blank, the name is replaced correctly.

The following are the test program, Flang-new compilation result.

test.F90:
```fortran
#define PRECISION 8
subroutine foo_&
&PRECISION &
&(a,b)
  real(kind=8) :: a, b
  a = a + b
end subroutine foo_&
&PRECISION
```

```
$ flang-new -c -cpp test.F90
error: Semantic errors in test.F90
./test.F90:7:16: error: SUBROUTINE name mismatch
  end subroutine foo_&
 ^
./test.F90:2:12: should be
  subroutine foo_&
 ^
$
$ flang-new -c -cpp -save-temps test.F90
error: Semantic errors in test.i
./test.F90:7:22: error: SUBROUTINE name mismatch
        end subroutine foo_8
                       ^^^^^
./test.F90:2:18: should be
        subroutine foo_PRECISION(a,b)
 ^^^^^^^^^^^^^
$
$ cat test.i
#line "./test.F90" 2
 subroutine foo_PRECISION(a,b)


      real(kind=8) :: a, b
 a = a + b
      end subroutine foo_8
$
```

test2.F90:
```fortran
#define PRECISION 8
subroutine foo_&
&PRECISION&
&(a,b)
!&PRECISION &
!&(a,b)
  real(kind=8) :: a, b
  a = a + b
end subroutine foo_&
&PRECISION
```

```
$ flang-new -c -cpp test2.F90
$
```

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