Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Flang] Incorrect diagnose on SELECT TYPE selector #81910

Closed
DanielCChen opened this issue Feb 15, 2024 · 4 comments · Fixed by #82806
Closed

[Flang] Incorrect diagnose on SELECT TYPE selector #81910

DanielCChen opened this issue Feb 15, 2024 · 4 comments · Fixed by #82806
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior flang:frontend

Comments

@DanielCChen
Copy link
Contributor

Consider the following code:

module m
type base
integer i
end type
end module

subroutine sub(arg)
use m
class(base) :: arg(*)
select type (arg)
  type is (Base)
     print *, "typeis"
  class default
     print *, "classdefault"
  end select
end

Flang currently issues an error as:

error: Semantic errors in t.f
./t.f:10:14: error: Whole assumed-size array 'arg' may not appear here without subscripts
  select type (arg)
               ^^^
./t.f:9:16: Declaration of 'arg'
  class(base) :: arg(*)
                 ^^^

It doesn't seem correct to me. The SELECT TYPE inquires the dynamic type of the selctor. It shouldn't matter if it is a assumed-size whole array or not.

@DanielCChen DanielCChen added flang:frontend flang Flang issues not falling into any other category flang:semantics labels Feb 15, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Feb 15, 2024

@llvm/issue-subscribers-flang-frontend

Author: Daniel Chen (DanielCChen)

Consider the following code: ``` module m type base integer i end type end module

subroutine sub(arg)
use m
class(base) :: arg(*)
select type (arg)
type is (Base)
print *, "typeis"
class default
print *, "classdefault"
end select
end


Flang currently issues an error as:

error: Semantic errors in t.f
./t.f:10:14: error: Whole assumed-size array 'arg' may not appear here without subscripts
select type (arg)
^^^
./t.f:9:16: Declaration of 'arg'
class(base) :: arg(*)
^^^


It doesn't seem correct to me. The SELECT TYPE inquires the dynamic type of the `selctor`. It shouldn't matter if it is a assumed-size whole array or not.
</details>

@EugeneZelenko EugeneZelenko removed flang Flang issues not falling into any other category flang:semantics labels Feb 15, 2024
@psteinfeld psteinfeld added the bug Indicates an unexpected problem or unintended behavior label Feb 15, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Feb 15, 2024

@llvm/issue-subscribers-bug

Author: Daniel Chen (DanielCChen)

Consider the following code: ``` module m type base integer i end type end module

subroutine sub(arg)
use m
class(base) :: arg(*)
select type (arg)
type is (Base)
print *, "typeis"
class default
print *, "classdefault"
end select
end


Flang currently issues an error as:

error: Semantic errors in t.f
./t.f:10:14: error: Whole assumed-size array 'arg' may not appear here without subscripts
select type (arg)
^^^
./t.f:9:16: Declaration of 'arg'
class(base) :: arg(*)
^^^


It doesn't seem correct to me. The SELECT TYPE inquires the dynamic type of the `selctor`. It shouldn't matter if it is a assumed-size whole array or not.
</details>

@klausler klausler self-assigned this Feb 23, 2024
klausler added a commit to klausler/llvm-project that referenced this issue Feb 23, 2024
Include variable selectors ("select type (x => y)") as a context
in which a whole assumed-size array may legitimately appear.

Fixes llvm#81910.
@klausler
Copy link
Contributor

#82806

@DanielCChen
Copy link
Contributor Author

I have verified PR #82806 has fixed the reproducer and the origin test case.
Thanks for the quick fix! @klausler

klausler added a commit to klausler/llvm-project that referenced this issue Feb 28, 2024
Include variable selectors ("select type (x => y)") as a context
in which a whole assumed-size array may legitimately appear.

Fixes llvm#81910.
klausler added a commit to klausler/llvm-project that referenced this issue Feb 28, 2024
Include variable selectors ("select type (x => y)") as a context
in which a whole assumed-size array may legitimately appear.

Fixes llvm#81910.
klausler added a commit to klausler/llvm-project that referenced this issue Feb 29, 2024
Include variable selectors ("select type (x => y)") as a context
in which a whole assumed-size array may legitimately appear.

Fixes llvm#81910.
klausler added a commit that referenced this issue Mar 2, 2024
Include variable selectors ("select type (x => y)") as a context in
which a whole assumed-size array may legitimately appear.

Fixes #81910.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior flang:frontend
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants