Skip to content

[Flang] Compile error when component-name declared in declaration-type-spec (class) with pointer attribute is used as an argument to entry statement #132648

Open
@ohno-fj

Description

@ohno-fj
Version of flang : 21.0.0(3e6f618e86f5fbad2c2d5802416ec3d3366a2837)/AArch64

When component-name (cy1) declared in declaration-type-spec (class) with pointer attribute is used as an argument to entry statement, a compilation error occurs.

The following are the test program, Flang, Gfortran and ifx compilation/execution result.

snggr249_22.f90:

module m3
  type x1
     integer::ix1
  end type x1
  type,extends(x1)::x2
  end type x2
  type,extends(x2)::x3
  end type x3
  class(x1),pointer,dimension(:)::cy1
contains
  subroutine dummy()
  entry      chk(c1)
   class(x1),dimension(3)::c1
 end subroutine dummy
end module m3

subroutine s1
  use m3
  type(x1),target::ty1(3)
  ty1%ix1=[1,2,3]
  cy1=>ty1
  call chk(cy1)
end subroutine s1

program main
  call s1
  print *,'pass'
end program main
$ flang snggr249_22.f90
error: loc("/work/home/ohno/CT/test/fort/tp/reproducerJ/PETA_V1020_PT3_FFE02/snggr249_22.f90":13:28): 'hlfir.declare' op for box address must not have a shape operand
error: verification of lowering to FIR failed
$
$ gfortran snggr249_22.f90; ./a.out
 pass
$
$ ifx snggr249_22.f90; ./a.out
 pass
$

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions