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] Crash on nested PDT with len parameter #63198

Closed
ashe2 opened this issue Jun 8, 2023 · 5 comments
Closed

[flang] Crash on nested PDT with len parameter #63198

ashe2 opened this issue Jun 8, 2023 · 5 comments
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior crash Prefer [crash-on-valid] or [crash-on-invalid] flang:frontend

Comments

@ashe2
Copy link

ashe2 commented Jun 8, 2023

Running Flang-new on the source file below results in an illegal instruction:

$ flang-new test.f90
flang-new: error: unable to execute command: Illegal instruction: 4
flang-new: error: flang frontend command failed due to signal (use -v to see invocation)
flang-new version 17.0.0 (git@github.com:llvm/llvm-project.git 02ce49afb9a078932c74f4d9b43189a5567e54e9)
Target: x86_64-apple-darwin22.5.0

It appears to be infinite recursion in FoldOperation(FoldingContext &, TypeParamInquiry &&)

Source file:

subroutine test
    implicit none
    type Part(dim)
        integer, len :: dim
    end type
    type Collection(dim)
        integer, len    :: dim
        type(Part(dim)) :: parts
    end type
    integer :: len = 10
    type(Collection(len)) :: c
end subroutine

This is based on an example from the Fortran discourse:
https://fortran-lang.discourse.group/t/working-with-parameterised-derived-type-containing-array-of-parameterised-derived-type/5823

@EugeneZelenko EugeneZelenko added crash Prefer [crash-on-valid] or [crash-on-invalid] flang Flang issues not falling into any other category and removed new issue labels Jun 8, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Jun 21, 2023

@llvm/issue-subscribers-flang-frontend

@psteinfeld psteinfeld added the bug Indicates an unexpected problem or unintended behavior label Jun 21, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Jun 21, 2023

@llvm/issue-subscribers-bug

@klausler klausler self-assigned this Jun 21, 2023
@klausler
Copy link
Contributor

@EugeneZelenko EugeneZelenko removed the flang Flang issues not falling into any other category label Jun 21, 2023
klausler added a commit that referenced this issue Jun 22, 2023
When a LEN type parameter of one PDT is being used as the value
of a LEN type parameter in another PDT, expression rewriting can
loop infinitely due to an incorrect assumption that the same PDT's
parameters are being referenced.

Fixes LLVM bug #63198

Differential Revision: https://reviews.llvm.org/D153465
@klausler
Copy link
Contributor

Fix merged.

@ashe2
Copy link
Author

ashe2 commented Jun 22, 2023

Thanks!

Chenyang-L pushed a commit to intel/llvm that referenced this issue Jul 11, 2023
When a LEN type parameter of one PDT is being used as the value
of a LEN type parameter in another PDT, expression rewriting can
loop infinitely due to an incorrect assumption that the same PDT's
parameters are being referenced.

Fixes LLVM bug llvm/llvm-project#63198

Differential Revision: https://reviews.llvm.org/D153465
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 crash Prefer [crash-on-valid] or [crash-on-invalid] flang:frontend
Projects
None yet
Development

No branches or pull requests

6 participants