public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/105117] New: automatic deallocation of objects in procedures with heap arrays
@ 2022-03-31 5:01 a.shahmoradi at gmail dot com
2022-03-31 17:46 ` [Bug fortran/105117] " anlauf at gcc dot gnu.org
2022-03-31 18:44 ` anlauf at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: a.shahmoradi at gmail dot com @ 2022-03-31 5:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105117
Bug ID: 105117
Summary: automatic deallocation of objects in procedures with
heap arrays
Product: gcc
Version: 11.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: a.shahmoradi at gmail dot com
Target Milestone: ---
The following code yields a runtime error when compiled with heap arrays option
`gfortran -fmax-stack-var-size=10 main.f90 -o`,
```
call testAutoDealloc
call testAutoDealloc
contains
subroutine testAutoDealloc
real, allocatable :: temp(:)
allocate(temp(200))
!deallocate(temp)
end
end
```
The problem is that `temp` is not automatically deallocated when the program
returns the control to the main scoping unit. To the best of my knowledge, this
appears to be a bug. Allocatable should be automatically deallocated when it is
out of scope, regardless of heap vs. stack usage. Intel ifort has no issues
with it. The code can be tested here:
https://godbolt.org/z/9z48Tze8c
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/105117] automatic deallocation of objects in procedures with heap arrays
2022-03-31 5:01 [Bug fortran/105117] New: automatic deallocation of objects in procedures with heap arrays a.shahmoradi at gmail dot com
@ 2022-03-31 17:46 ` anlauf at gcc dot gnu.org
2022-03-31 18:44 ` anlauf at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-03-31 17:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105117
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2022-03-31
--- Comment #1 from anlauf at gcc dot gnu.org ---
There seems to be a threshold at -fmax-stack-var-size=64.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/105117] automatic deallocation of objects in procedures with heap arrays
2022-03-31 5:01 [Bug fortran/105117] New: automatic deallocation of objects in procedures with heap arrays a.shahmoradi at gmail dot com
2022-03-31 17:46 ` [Bug fortran/105117] " anlauf at gcc dot gnu.org
@ 2022-03-31 18:44 ` anlauf at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-03-31 18:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105117
--- Comment #2 from anlauf at gcc dot gnu.org ---
(In reply to anlauf from comment #1)
> There seems to be a threshold at -fmax-stack-var-size=64.
The threshold is 64 for -m64, and 36 for -m32.
Could it be that the limit applies to the array descriptor instead of the
array?
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-31 18:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-31 5:01 [Bug fortran/105117] New: automatic deallocation of objects in procedures with heap arrays a.shahmoradi at gmail dot com
2022-03-31 17:46 ` [Bug fortran/105117] " anlauf at gcc dot gnu.org
2022-03-31 18:44 ` anlauf at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).