| Issue |
239620
|
| Summary |
[flang] Folding the parent component of a derived-type constant (`x%p`) miscounts the components when `p` itself extends a type: lowering assertion `index < getNumFields()`, or an `undef` component
|
| Labels |
crash,
flang,
generated by fuzzer
|
| Assignees |
|
| Reporter |
YuanchengJiang
|
The following code:
```fortran
module m
type t
end type
type, extends(t) :: p
integer :: a
end type
type, extends(p) :: c
integer :: b
end type
type(c), parameter :: x = c(1, 2)
type(p), parameter :: y = x%p
end module
```
Resulted in this output:
```
flang-24: error: unable to execute command: Segmentation fault (core dumped)
Stack dump:
#3 genInlinedStructureCtorLitImpl
#4 genScalarLit
#5 Fortran::lower::ConstantBuilder::gen
#6 genConstantValue
#7 Fortran::lower::genConstantExprValue
#8 std::_Function_handler::_M_invoke
#9 createGlobalInitialization
#10 Fortran::lower::defineGlobal
```
Trunk reproducer: https://godbolt.org/z/EadcxbEsj
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs