Skip to content

[Flang] Compilation error when INT is specified in generic-name of interface statement and in internal function #88677

Closed
@ohno-fj

Description

@ohno-fj
Version of flang-new : 19.0.0(4f19f15a601a5761b12c9c66d99d97dbc89ef90d)/AArch64

When INT is specified as generic-name in interface statement, INT intrinsic function in internal function (F1) results in a compilation error.

When line 7 of the program is changed as follows, the compilation terminates normally.

  • Before the change
    INTEGER :: A(INT(1_4))
  • After the change
    INTEGER :: A(1_4)

The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.

snggx159_3.f90:

MODULE MOD
  INTERFACE INT
     MODULE PROCEDURE F1
  END INTERFACE INT
CONTAINS
  INTEGER PURE FUNCTION F1(I)
    INTEGER :: A(INT(1_4))
    INTEGER, PARAMETER :: KIND = SIZE(A)
    INTEGER(KIND), INTENT(IN) :: I
    F1 = I+ 1000
  END FUNCTION F1
END MODULE MOD

program main
  use mod
  if (INT(1_4)/=1) print *,1
  print *,'pass'
end program main
flang-new snggx159_3.f90
error: Semantic errors in snggx159_3.f90
./snggx159_3.f90:7:18: error: Procedure 'f1' is referenced before being sufficiently defined in a context where it must be so
      INTEGER :: A(INT(1_4))
                   ^^^^^^^^
$
$ gfortran snggx159_3.f90; ./a.out
 pass
$
$ ifort -diag-disable=10448 snggx159_3.f90; ./a.out
 pass
$

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behaviorflang:frontend

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions