public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcc/106949] New: Memory leak using VLA with -fsplit-stack
@ 2022-09-15  8:18 iam at datacompboy dot ru
  2022-09-15  8:21 ` [Bug libgcc/106949] " iam at datacompboy dot ru
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: iam at datacompboy dot ru @ 2022-09-15  8:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106949
           Summary: Memory leak using VLA with -fsplit-stack
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgcc
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iam at datacompboy dot ru
  Target Milestone: ---

Created attachment 53575
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53575&action=edit
minimal repro case

Having a function with couple of VLA arrays enough to cause a memory leak.

If you run the function in a loop, memory leak only grows.

```
$ gcc -fsplit-stack -g b.c && valgrind ./a.out
==6861== HEAP SUMMARY:
==6861==     in use at exit: 20,040 bytes in 2 blocks
==6861==   total heap usage: 2 allocs, 0 frees, 20,040 bytes allocated
==6861==
==6861== LEAK SUMMARY:
==6861==    definitely lost: 24 bytes in 1 blocks
==6861==    indirectly lost: 20,016 bytes in 1 blocks
```

With a loop running function 10k times:
```
$ gcc -fsplit-stack -g c.c && valgrind ./a.out
==6931== HEAP SUMMARY:
==6931==     in use at exit: 569,801,800 bytes in 32,162 blocks
==6931==   total heap usage: 32,162 allocs, 0 frees, 569,801,800 bytes
allocated
==6931==
==6931== LEAK SUMMARY:
==6931==    definitely lost: 385,944 bytes in 16,081 blocks
==6931==    indirectly lost: 569,121,904 bytes in 16,072 blocks
==6931==      possibly lost: 293,952 bytes in 9 blocks
```

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

end of thread, other threads:[~2022-10-04 15:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-15  8:18 [Bug libgcc/106949] New: Memory leak using VLA with -fsplit-stack iam at datacompboy dot ru
2022-09-15  8:21 ` [Bug libgcc/106949] " iam at datacompboy dot ru
2022-10-03 12:25 ` iam at datacompboy dot ru
2022-10-04  0:22 ` ian at airs dot com
2022-10-04 12:16 ` [Bug libgcc/106949] Memory leak using VLA/alloca " iam at datacompboy dot ru
2022-10-04 15:50 ` iam at datacompboy dot ru

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