Skip to content

[Flang][Assumed-rank] Missing diagnose on invalid assumed-rank actual argument #114080

Closed
@DanielCChen

Description

@DanielCChen

Consider the following code:

subroutine sub(arg)
  character(*) :: arg(..)

  interface
   subroutine sub1(arg1) bind(c)
     character(1) :: arg1(2,4)
   end subroutine
  end interface

  call sub1(arg)                    ! Invalid
  call sub2(arg)                    ! Invalid
  contains
    subroutine sub2(arg2)
      character(*) :: arg2(10)
    end subroutine sub2
end subroutine

Both calls to sub1 and sub2 are invalid based on c840 in the standard
[8.5.8.7]

C840 An assumed-rank variable name shall not appear in a designator or expression except as an actual argument that corresponds to a dummy argument that is assumed-rank, the argument of the function C_LOC or C_SIZEOF from the intrinsic module ISO_C_BINDING (18.2), the first dummy argument of an intrinsic inquiry function, or the selector of a SELECT RANK statement.

I don't see this can be a reasonable extension. Even it is, it seems not documented.

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behaviorflang:frontend

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions