Issue 113842
Summary [Flang] Value of component-part when component-part of derived type is uninitialized
Labels flang
Assignees
Reporter ohno-fj
    ```
Version of flang-new : 20.0.0(c2717a89b8437d041d532c7b2c535ca4f4b35872)/AArch64
```

This is for value of `component-part` when `component-part` of `derived type` is uninitialized.  
When `component` of `derived type` inherited from parent has three nest levels, `the uninitialized value (ma)` does not seem to be initialized with 0.  
The above program is `3-P-405-tas-extends01_131.f90`

However, for two nest levels, it seems to be initialized with 0.  
The above program is `3-P-405-tas-extends01_132.f90`

The following are the test program, Flang-new, Gfortran and ifx compilation/execution result.

3-P-405-tas-extends01_131.f90:
```fortran
program main
  type tp1
     integer(kind=4) :: ma
     integer(kind=4) :: mb = 3
  end type tp1

  type, extends(tp1) :: tp2
 integer(kind=4) :: mc = 4
  end type tp2

  type, extends(tp2) :: tp3
     integer(kind=4) :: md = 5
  end type tp3

  type(tp1) t1
  type(tp2) t2
  type(tp3) t3
  print *, t1
  print *, t2
 print *, t3
end program main
```

```
$ flang-new 3-P-405-tas-extends01_131.f90; ./a.out
 56 3
 791621423 3 4
 -1431655766 3 4 5
$
```

```
$ gfortran 3-P-405-tas-extends01_131.f90; ./a.out
           0           3
 0           3           4
           0           3           4 5
$
```

```
$ ifx 3-P-405-tas-extends01_131.f90; ./a.out
 0           3
           0           3           4
 0           3           4 5
$
```

3-P-405-tas-extends01_132.f90:
```fortran
program main
  type tp1
     integer(kind=4) :: ma
     integer(kind=4) :: mb = 3
  end type tp1

  type, extends(tp1) :: tp2
 integer(kind=4) :: mc = 4
  end type tp2

!  type, extends(tp2) :: tp3
!     integer(kind=4) :: md = 5
!  end type tp3

  type(tp1) t1
  type(tp2) t2
!  type(tp3) t3
  print *, t1
  print *, t2
!  print *, t3
end program main
```

```
$ flang-new 3-P-405-tas-extends01_132.f90; ./a.out
 0 3
 0 3 4
$
```

```
$ gfortran 3-P-405-tas-extends01_132.f90; ./a.out
           0           3
           0           3 4
$
```

```
$ ifx 3-P-405-tas-extends01_132.f90; ./a.out
 0           3
           0           3 4
$
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to