Skip to content

[flang] included sources are parsing separately  #78928

Closed
@foxtran

Description

@foxtran

With the following code:

      subroutine test(
#include "args.f"
      end

And args.f:

     $arg)
      integer :: arg

flang-new gives the following message:

error: Could not scan test.f
./test.f:1:22: error: Unmatched '('
        subroutine test(
                       ^
./args.f:1:6: warning: Statement should not begin with a continuation line
       $arg)
       ^
./test.f:2:1: warning: included here
  #include "args.f"
  ^^^^^^^^^^^^^^^^^
./args.f:1:10: error: Unmatched ')'
       $arg)
           ^
./test.f:2:1: error: included here
  #include "args.f"
  ^^^^^^^^^^^^^^^^^

It happens because each source and include files are tokenizing separately, without full context.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions