Skip to content

[flang][preprocessor] C preprocessor can not be inside of statement #95476

@foxtran

Description

@foxtran

With the following example,

! example
subroutine test( &
ARG1, &
! test
#ifndef SWAP
#define ARG1 FA
#define ARG2 FB
#else
#define ARG1 FB
#define ARG2 FA
#endif
ARG1, ARG2, &
! test
#undef ARG1
#undef ARG2
&ARG2)
! comment
end

flang-new fails with the following errors:

error: Could not scan test.f90
./test.f90:2:16: error: Unmatched '('
  subroutine test( &
                 ^
./test.f90:12:13: error: bad character ('&') in Fortran token
  ARG1, ARG2, &
              ^
./test.f90:16:1: error: bad character ('&') in Fortran token
  &ARG2)
  ^
./test.f90:16:6: error: Unmatched ')'
  &ARG2)
       ^

Used version (after applying #95332, #93382):

$ flang-new --version
flang-new version 19.0.0git (https://github.com/llvm/llvm-project.git 41587739a63f7622c36715421d215f07d79f9a7d)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions