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

            Bug ID: 84439
           Summary: call to backtrace fails after about 6000 iterations
                    (32-bit executable)
           Product: gcc
           Version: 4.8.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kapfell at gmx dot de
  Target Milestone: ---

Created attachment 43448
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43448&action=edit
Test calling backtrace() repeatedly, fails after about 5600 iteration (32-bit
executable)

There appears to be a memory leak in backtrace(). At about 5500 iterations mmap
complains about insufficient memory and stack trace no longer shows function
names:

[...]
#0  0xf7667245 in ???
#1  0xf7667289 in ???
#2  0x804874b in fun5_
        at [...]/gf_backtrace.f:44
#3  0x80486c6 in fun4_
        at [...]/gf_backtrace.f:37
#4  0x80486b3 in fun3_
        at [...]/gf_backtrace.f:31
#5  0x80486a0 in fun2_
        at [...]/gf_backtrace.f:25
#6  0x804868d in fun1_
        at [...]/gf_backtrace.f:19
#7  0x804877b in testbacktrace
        at [...]/gf_backtrace.f:12
#8  0x80487ce in main
        at [...]/gf_backtrace.f:14
 5696 calls to backtrace()
Could not print backtrace: mmap: Cannot allocate memory
#0  0xf7633273
#1  0xf7633289
#2  0x80487bd
#3  0x804871a
#4  0x80486f2
#5  0x80486ca
#6  0x80486a2
#7  0x8048802
#8  0x8048855
#9  0xf73c0672
#10  0x80485a0
[fun5 (  46)]  5697 calls to backtrace()
[...]

System: OpenSUSE 42.3, x86_64, kernel 4.4.114. Test program is attached, 
compile with :
  gfortran -m32 -o bug-report-backtrace -g -Wall -Wextra -std=gnu
bug-report-backtrace.f

Thanks

Reply via email to