Skip to content

[Flang] When there are multiple statements on a line, the preprocessor does not work correctly. #112279

@ohno-fj

Description

@ohno-fj
Version of flang-new : 20.0.0(7f65377880ce6a0e5eaa4cb2591b86b8c8a24ee6)/AArch64

When building EigenExa Version 2.12, the following error is detected.
When there are multiple statements on a line, the preprocessor does not work correctly.
The above program is bisect2_short2.F.
When there is one statement on a line, the preprocessor works correctly.
The above program is bisect2_short22.F.

The following are a self-made reproducer, Flang-new compilation result.

bisect2_short2.F:

      subroutine sub()
#define p(i,j)          p_ i _ j

      real(8)                ::  p_1_1
      real(8)                ::  p_2_1, p_2_2
      p(1,1) = 1.
      p(2,1) = 0.; p(2,2) = 1.

      end
$ flang-new bisect2_short2.F -E
#line "./bisect2_short2.F" 1
      subroutine sub()


      real(8)                ::  p_1_1
      real(8)                ::  p_2_1, p_2_2
      p_ 1 _1= 1.
      p_ 2 _1= 0.; p_2_2  = 1.

      end
$

bisect2_short22.F:

      subroutine sub()
#define p(i,j)          p_ i _ j

      real(8)                ::  p_1_1
      real(8)                ::  p_2_1, p_2_2
      p(1,1) = 1.
!      p(2,1) = 0.; p(2,2) = 1.
      p(2,1) = 0.
      p(2,2) = 1.

      end
$ flang-new bisect2_short22.F -E
#line "./bisect2_short22.F" 1
      subroutine sub()


      real(8)                ::  p_1_1
      real(8)                ::  p_2_1, p_2_2
      p_ 1 _1= 1.

      p_ 2 _1= 0.
      p_ 2 _2= 1.

      end
$

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions