Skip to content

[flang] CHECK(array) failed in Folder::ApplyComponent when folding a component of a PARAMETER array of an extended type whose parent has an undefined component type #239945

Open

Description

@YuanchengJiang

The following code:

module m
  type :: t2
    type(t1) :: x = t1()
  end type
  type, extends(t2) :: t
    complex :: z
  end type
  type(t), parameter :: tz(*) = [t((3., 4.)), t((5., 6.))]
  logical, parameter :: test_6 = all(tz%z%im == [4., 6.])
end module

Resulted in this output:

fatal internal error: CHECK(array) failed at /root/llvm-project/flang/lib/Evaluate/fold-implementation.h(343)

Trunk reproducer (-fsyntax-only): https://godbolt.org/z/ser58sKd8

Activity

  1. added
    crashPrefer [crash-on-valid] or [crash-on-invalid]
    flangFlang issues not falling into any other category
    generated by fuzzerRegression test generated by fuzzing or AI analysis - not a real world code snippet
    on Nov 7, 2026
  2. added and removed
    flangFlang issues not falling into any other category
    on Nov 7, 2026
  3. llvmorg-github-actions commented on Nov 7, 2026

    @llvmorg-github-actions

    @llvm/issue-subscribers-flang-frontend

    Author: Jiang Yuancheng (YuanchengJiang)

    Details The following code: ```fortran module m type :: t2 type(t1) :: x = t1() end type type, extends(t2) :: t complex :: z end type type(t), parameter :: tz(*) = [t((3., 4.)), t((5., 6.))] logical, parameter :: test_6 = all(tz%z%im == [4., 6.]) end module ```

    Resulted in this output:

    fatal internal error: CHECK(array) failed at /root/llvm-project/flang/lib/Evaluate/fold-implementation.h(343)
    

    Trunk reproducer (-fsyntax-only): https://godbolt.org/z/ser58sKd8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    crashPrefer [crash-on-valid] or [crash-on-invalid]flang:frontendgenerated by fuzzerRegression test generated by fuzzing or AI analysis - not a real world code snippet

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions