Issue |
138809
|
Summary |
[Flang] Execution error in assignment between derived types due to incorrect GENERIC statement
|
Labels |
flang
|
Assignees |
|
Reporter |
ohno-fj
|
```
Version of flang : 21.0.0(842e5915778a820c63cf38b75bec932a6ea8c18b)/AArch64
```
Because `GENERIC statement` does not work, an assignment between `derived types (v21 and v22)` results in a run-time error.
A run-time error occurs on line 28:
```
v22=v21
```
When the following statement is added before line 28, the result is `Segmentation fault (core dumped) `:
```
ALLOCATE(v22(1)%x22%x11(2))
```
The following are the test program, Flang, Gfortran and ifx compilation/execution result.
Typebound_op_FT_005_2332.f90:
```fortran
MODULE m1
TYPE t1
INTEGER,POINTER:: x11(:)
CONTAINS
PROCEDURE:: t_prc=>prc
GENERIC:: ASSIGNMENT(=) => t_prc
END TYPE t1
CONTAINS
SUBROUTINE prc(x,y)
CLASS(t1),INTENT(OUT)::x
CLASS(t1),INTENT(IN)::y
x%x11 = y%x11+100
END SUBROUTINE prc
END MODULE m1
PROGRAM MAIN
USE m1
TYPE t2
TYPE(t1):: x22
END TYPE t2
CALL s1
CONTAINS
SUBROUTINE s1
TYPE(t2):: v21(1),v22(1)
ALLOCATE(v21(1)%x22%x11(2))
v21(1)%x22%x11=1
write(6,*) "v21(1)%x22%x11 = ", v21(1)%x22%x11
v22=v21
END SUBROUTINE s1
END PROGRAM MAIN
```
```
$ flang Typebound_op_FT_005_2332.f90; ./a.out
v21(1)%x22%x11 = 1 1
fatal Fortran runtime error(/work/home/ohno/CT/test/fort/tp/reproducerJ/CL_NEXT_PT3_14/Typebound_op_FT_005_2332.f90:12): Assign: mismatching element counts in array assignment (to 187651055140848, from 2)
Aborted (core dumped)
$
```
```
$ gfortran Typebound_op_FT_005_2332.f90; ./a.out
v21(1)%x22%x11 = 1 1
$
```
```
$ ifx Typebound_op_FT_005_2332.f90; ./a.out
v21(1)%x22%x11 = 1 1
$
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs