| Issue |
178786
|
| Summary |
[Flang] Allocation of an extension type causes a runtime error
|
| Labels |
flang
|
| Assignees |
|
| Reporter |
boo-aboutme
|
``` text
Version of flang: 23.0.0git (https://github.com/llvm/llvm-project.git eb773961aac45593ce126ed258d82c3c3abbaa93)
Target: aarch64-unknown-linux-gnu
```
The executable object compiled with Flang for the following program causes a runtime error when allocating a variable of an extension type.
Expected behavior:
The program should compile and run successfully, printing "test.f90 : pass" without errors.
``` fortran
$ flang test.f90
$ ./a.out
Fatal glibc error: malloc.c:2492 (sysmalloc): assertion failed: (old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)
```
test.f90
``` fortran
module mod
type :: b
integer::d1
type (e),allocatable::n
integer::dd1(1000)
end type
type,extends(b) :: e
integer::d2
character(:),allocatable::c
end type
contains
subroutine alloc(d)
class (b),allocatable :: d
allocate(e::d)
end subroutine alloc
subroutine s1
class (b),allocatable :: v
call alloc(v)
deallocate(v)
end
end module mod
use mod
call s1
print *,'test.f90 : pass'
end
```
Results of other compilers:
Intel Ifx:
``` shell
$ ifx --version
ifx (IFX) 2024.2.1 20240711
Copyright (C) 1985-2024 Intel Corporation. All rights reserved.
$ ifx test.f90
$ ./a.out
test.f90 : pass
```
Fujitsu frt:
``` shell
$ frt --version
frt (FRT) 4.12.1 20250711
Copyright FUJITSU LIMITED 2019-2025
$ frt test.f90
$ ./a.out
test.f90 : pass
```
GNU gfortran: (x86-64 gfortran 15.1 on compiler explorer)
``` shell
Program returned: 0
Program stdout
test.f90 : pass
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs