public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/115689] New: Missed deallocation before exit
@ 2024-06-27 20:31 jvdelisle2 at gmail dot com
  2024-06-27 20:46 ` [Bug fortran/115689] " kargls at comcast dot net
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: jvdelisle2 at gmail dot com @ 2024-06-27 20:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115689

            Bug ID: 115689
           Summary: Missed deallocation before exit
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jvdelisle2 at gmail dot com
  Target Milestone: ---

The following gives valgrind error when the deallocate is commented out:

program test
  integer, allocatable, dimension(:) :: VLQ
  integer i, filo
  allocate(VLQ(0))
  do i=1, 5
    filo = 2**i + 27
    VLQ = [ VLQ, int(filo) ]
    print *, VLQ
  end do
  !deallocate(VLQ)
end program

==16247== HEAP SUMMARY:
==16247==     in use at exit: 20 bytes in 1 blocks
==16247==   total heap usage: 38 allocs, 37 frees, 5,645 bytes allocated
==16247== 
==16247== LEAK SUMMARY:
==16247==    definitely lost: 20 bytes in 1 blocks

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/115689] Missed deallocation before exit
  2024-06-27 20:31 [Bug fortran/115689] New: Missed deallocation before exit jvdelisle2 at gmail dot com
@ 2024-06-27 20:46 ` kargls at comcast dot net
  2024-06-27 23:32 ` jvdelisle2 at gmail dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: kargls at comcast dot net @ 2024-06-27 20:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115689

kargls at comcast dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargls at comcast dot net

--- Comment #1 from kargls at comcast dot net ---
Yep.

Valgrind giving a warning here is questionable.  Is there an operating system,
where gfortran works, that does not reap resources committed to a terminating
process?

In other words, not a gfortran problem.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/115689] Missed deallocation before exit
  2024-06-27 20:31 [Bug fortran/115689] New: Missed deallocation before exit jvdelisle2 at gmail dot com
  2024-06-27 20:46 ` [Bug fortran/115689] " kargls at comcast dot net
@ 2024-06-27 23:32 ` jvdelisle2 at gmail dot com
  2024-06-28  2:13 ` kargls at comcast dot net
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle2 at gmail dot com @ 2024-06-27 23:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115689

--- Comment #2 from Jerry DeLisle <jvdelisle2 at gmail dot com> ---
Well I do not know about how all the hooks work but this is with the following
configure:

../trunk/configure --prefix=/home/jerry/dev/usr
--enable-languages=c,c++,fortran --enable-libgomp --disable-bootstrap
--enable-valgrind-annotations

Enabling the valgrind annotations should give fairly accurate results. I do not
know what you get on FreeBSD OS. I was using Fedora 40 OS.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/115689] Missed deallocation before exit
  2024-06-27 20:31 [Bug fortran/115689] New: Missed deallocation before exit jvdelisle2 at gmail dot com
  2024-06-27 20:46 ` [Bug fortran/115689] " kargls at comcast dot net
  2024-06-27 23:32 ` jvdelisle2 at gmail dot com
@ 2024-06-28  2:13 ` kargls at comcast dot net
  2024-06-28  3:28 ` jvdelisle2 at gmail dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: kargls at comcast dot net @ 2024-06-28  2:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115689

--- Comment #3 from kargls at comcast dot net ---
The code you posted is standard conforming, and when
compiled, executes as expected.

My point is that the program is exiting.  The operate system will
reap the process and reclaim the memory.  Valgrind need not warn
about this.  It is just noise.  It is not a memory leak.  If anything
it is poor programming on the part of the person that wrote the
code, and arguably a bug the code.

If the valgrind nonsense bothers a programmer, then the programmer
can do the explicit deallocation.

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115689
>
> --- Comment #2 from Jerry DeLisle <jvdelisle2 at gmail dot com> ---
> Well I do not know about how all the hooks work but this is with the following
> configure:
>
> ../trunk/configure --prefix=/home/jerry/dev/usr
> --enable-languages=c,c++,fortran --enable-libgomp --disable-bootstrap
> --enable-valgrind-annotations
>
> Enabling the valgrind annotations should give fairly accurate results. I do not
> know what you get on FreeBSD OS. I was using Fedora 40 OS.
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/115689] Missed deallocation before exit
  2024-06-27 20:31 [Bug fortran/115689] New: Missed deallocation before exit jvdelisle2 at gmail dot com
                   ` (2 preceding siblings ...)
  2024-06-28  2:13 ` kargls at comcast dot net
@ 2024-06-28  3:28 ` jvdelisle2 at gmail dot com
  2024-06-28  9:55 ` anlauf at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle2 at gmail dot com @ 2024-06-28  3:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115689

--- Comment #4 from Jerry DeLisle <jvdelisle2 at gmail dot com> ---
(In reply to kargls from comment #3)
> The code you posted is standard conforming, and when
> compiled, executes as expected.
> 
> My point is that the program is exiting.  The operate system will
> reap the process and reclaim the memory.  Valgrind need not warn
> about this.  It is just noise.  It is not a memory leak.  If anything
> it is poor programming on the part of the person that wrote the
> code, and arguably a bug the code.
> 

I agree completely, I would prefer that programmers explicitly deallocate.

I simply do not know what our expectations should be when testing.  Maybe in
this case it is a don't care. I posted the question for clarification from
others.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/115689] Missed deallocation before exit
  2024-06-27 20:31 [Bug fortran/115689] New: Missed deallocation before exit jvdelisle2 at gmail dot com
                   ` (3 preceding siblings ...)
  2024-06-28  3:28 ` jvdelisle2 at gmail dot com
@ 2024-06-28  9:55 ` anlauf at gcc dot gnu.org
  2024-06-28 12:24 ` mikael at gcc dot gnu.org
  2024-06-29 17:05 ` jvdelisle2 at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-06-28  9:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115689

--- Comment #5 from anlauf at gcc dot gnu.org ---
(In reply to Jerry DeLisle from comment #4)
> (In reply to kargls from comment #3)
> > The code you posted is standard conforming, and when
> > compiled, executes as expected.
> > 
> > My point is that the program is exiting.  The operate system will
> > reap the process and reclaim the memory.  Valgrind need not warn
> > about this.  It is just noise.  It is not a memory leak.  If anything
> > it is poor programming on the part of the person that wrote the
> > code, and arguably a bug the code.
> > 
> 
> I agree completely, I would prefer that programmers explicitly deallocate.

That's what I do in runtime tests (unless I forget to).

> I simply do not know what our expectations should be when testing.  Maybe in
> this case it is a don't care. I posted the question for clarification from
> others.

Running the program from comment#0 - compiled with ifx - under valgrind
gives here:

==12826== HEAP SUMMARY:
==12826==     in use at exit: 60 bytes in 1 blocks
==12826==   total heap usage: 13 allocs, 12 frees, 12,926 bytes allocated
==12826== 
==12826== LEAK SUMMARY:
==12826==    definitely lost: 0 bytes in 0 blocks
==12826==    indirectly lost: 0 bytes in 0 blocks
==12826==      possibly lost: 60 bytes in 1 blocks

But as Steve pointed out: this is irrelevant, just a hint to the programmer.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/115689] Missed deallocation before exit
  2024-06-27 20:31 [Bug fortran/115689] New: Missed deallocation before exit jvdelisle2 at gmail dot com
                   ` (4 preceding siblings ...)
  2024-06-28  9:55 ` anlauf at gcc dot gnu.org
@ 2024-06-28 12:24 ` mikael at gcc dot gnu.org
  2024-06-29 17:05 ` jvdelisle2 at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: mikael at gcc dot gnu.org @ 2024-06-28 12:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115689

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikael at gcc dot gnu.org

--- Comment #6 from Mikael Morin <mikael at gcc dot gnu.org> ---
This is similar to PR58433 (except there is no final procedure here).

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/115689] Missed deallocation before exit
  2024-06-27 20:31 [Bug fortran/115689] New: Missed deallocation before exit jvdelisle2 at gmail dot com
                   ` (5 preceding siblings ...)
  2024-06-28 12:24 ` mikael at gcc dot gnu.org
@ 2024-06-29 17:05 ` jvdelisle2 at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle2 at gmail dot com @ 2024-06-29 17:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115689

Jerry DeLisle <jvdelisle2 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #7 from Jerry DeLisle <jvdelisle2 at gmail dot com> ---
Thankyou for comments. I will close as not a bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-06-29 17:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-27 20:31 [Bug fortran/115689] New: Missed deallocation before exit jvdelisle2 at gmail dot com
2024-06-27 20:46 ` [Bug fortran/115689] " kargls at comcast dot net
2024-06-27 23:32 ` jvdelisle2 at gmail dot com
2024-06-28  2:13 ` kargls at comcast dot net
2024-06-28  3:28 ` jvdelisle2 at gmail dot com
2024-06-28  9:55 ` anlauf at gcc dot gnu.org
2024-06-28 12:24 ` mikael at gcc dot gnu.org
2024-06-29 17:05 ` jvdelisle2 at gmail dot com

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).