public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/54345] New: jump threading leaks e->aux heap memory
@ 2012-08-21 12:27 rguenth at gcc dot gnu.org
  2012-09-20  8:17 ` [Bug tree-optimization/54345] " polacek at redhat dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-08-21 12:27 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54345

             Bug #: 54345
           Summary: jump threading leaks e->aux heap memory
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: memory-hog
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rguenth@gcc.gnu.org


valgrind shows

==30772== 64 bytes in 4 blocks are definitely lost in loss record 15,347 of
29,883
==30772==    at 0x4C29ADD: malloc (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==30772==    by 0xCE28C7: xmalloc (xmalloc.c:147)
==30772==    by 0x99C8E8: thread_through_all_blocks(bool)
(tree-ssa-threadupdate.c:1134)
==30772==    by 0x92BDCF: tree_ssa_dominator_optimize() (tree-ssa-dom.c:790)
==30772==    by 0x818C3A: execute_one_pass(opt_pass*) (passes.c:2157)
==30772==    by 0x818F84: execute_pass_list(opt_pass*) (passes.c:2212)
==30772==    by 0x818F96: execute_pass_list(opt_pass*) (passes.c:2213)
==30772==    by 0x68F583: expand_function(cgraph_node*) (cgraphunit.c:1609)
==30772==    by 0x6909E8: compile() (cgraphunit.c:1714)
==30772==    by 0x690F64: finalize_compilation_unit() (cgraphunit.c:2089)
==30772==    by 0x564956: cp_write_global_declarations() (decl2.c:4024)
==30772==    by 0x8AABF4: compile_file() (toplev.c:560)

that would be easily solvable by using an obstack for the allocation
of the two pointers.  That would be cheaper as well.  It's lifetime
would be thread_through_all_blocks ().


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

* [Bug tree-optimization/54345] jump threading leaks e->aux heap memory
  2012-08-21 12:27 [Bug tree-optimization/54345] New: jump threading leaks e->aux heap memory rguenth at gcc dot gnu.org
@ 2012-09-20  8:17 ` polacek at redhat dot com
  2012-09-20 11:13 ` rguenther at suse dot de
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: polacek at redhat dot com @ 2012-09-20  8:17 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54345

Marek Polacek <polacek at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |polacek at redhat dot com

--- Comment #1 from Marek Polacek <polacek at redhat dot com> 2012-09-20 08:16:55 UTC ---
How can I reproduce this one?  I've built gcc with '--enable-languages=c,c++
--disable-bootstrap' and '--enable-languages=c,c++ --disable-bootstrap
--enable-checking=valgrind', but then e.g.
valgrind --leak-check=full --show-reachable=yes ./cc1
~/src/gcc/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-2.c -O2 -fno-tree-vrp
show nothing like this.  (In that test we certainly run the DOM pass, thus also
jump-threading.)  Or am I doing something stupid?


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

* [Bug tree-optimization/54345] jump threading leaks e->aux heap memory
  2012-08-21 12:27 [Bug tree-optimization/54345] New: jump threading leaks e->aux heap memory rguenth at gcc dot gnu.org
  2012-09-20  8:17 ` [Bug tree-optimization/54345] " polacek at redhat dot com
@ 2012-09-20 11:13 ` rguenther at suse dot de
  2012-09-21 15:11 ` polacek at redhat dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenther at suse dot de @ 2012-09-20 11:13 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54345

--- Comment #2 from rguenther at suse dot de <rguenther at suse dot de> 2012-09-20 11:12:36 UTC ---
On Thu, 20 Sep 2012, polacek at redhat dot com wrote:

> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54345
> 
> Marek Polacek <polacek at redhat dot com> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |polacek at redhat dot com
> 
> --- Comment #1 from Marek Polacek <polacek at redhat dot com> 2012-09-20 08:16:55 UTC ---
> How can I reproduce this one?  I've built gcc with '--enable-languages=c,c++
> --disable-bootstrap' and '--enable-languages=c,c++ --disable-bootstrap
> --enable-checking=valgrind', but then e.g.
> valgrind --leak-check=full --show-reachable=yes ./cc1
> ~/src/gcc/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-2.c -O2 -fno-tree-vrp
> show nothing like this.  (In that test we certainly run the DOM pass, thus also
> jump-threading.)  Or am I doing something stupid?

It obviously depends on the testcase.  I was using something very large.


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

* [Bug tree-optimization/54345] jump threading leaks e->aux heap memory
  2012-08-21 12:27 [Bug tree-optimization/54345] New: jump threading leaks e->aux heap memory rguenth at gcc dot gnu.org
  2012-09-20  8:17 ` [Bug tree-optimization/54345] " polacek at redhat dot com
  2012-09-20 11:13 ` rguenther at suse dot de
@ 2012-09-21 15:11 ` polacek at redhat dot com
  2012-09-24  8:52 ` rguenther at suse dot de
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: polacek at redhat dot com @ 2012-09-21 15:11 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54345

--- Comment #3 from Marek Polacek <polacek at redhat dot com> 2012-09-21 15:11:08 UTC ---
Hmm.  I hoped that something like this will show the leak, but no (it does a
lot of threading with -O2--through conditionals, through loop headers and also
through latches).  But obviously it's not enough.  Any ideas, please?

extern void bla (void);
extern void bar (void);
extern void foo (void);

void
thread_through_condition (int a, int b)
{
#define E if (a > b)    \
        bla ();    \
      else        \
        bar ();    \
      if (a <= b)    \
        foo ();
#define E10 E E E E E E E E E E
#define E100 E10 E10 E10 E10 E10 E10 E10 E10 E10 E10
#define E1000 E100 E100 E100 E100 E100 E100 E100 E100 E100 E100
#define EE E1000 E1000
  EE
}

void
thread_entry_through_header (void)
{
  int i;
#define A for (i = 0; i < 42; ++i) \
        bla ();
#define A10 A A A A A A A A A A
#define A100 A10 A10 A10 A10 A10 A10 A10 A10 A10 A10
#define A1000 A100 A100 A100 A100 A100 A100 A100 A100 A100 A100
#define AA A1000 A1000 A1000 A1000 A1000
  AA
}

void
thread_latch_through_header (void)
{
  int i = 0;
  int first;

#define L first = 1; i = 0;    \
      do {            \
        if (first)        \
          foo ();        \
        first = 0;        \
        bla ();        \
      } while (i++ < 100);
#define L10 L L L L L L L L L L
#define L100 L10 L10 L10 L10 L10 L10 L10 L10 L10 L10
#define L1000 L100 L100 L100 L100 L100 L100 L100 L100 L100 L100
  L1000
}


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

* [Bug tree-optimization/54345] jump threading leaks e->aux heap memory
  2012-08-21 12:27 [Bug tree-optimization/54345] New: jump threading leaks e->aux heap memory rguenth at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2012-09-21 15:11 ` polacek at redhat dot com
@ 2012-09-24  8:52 ` rguenther at suse dot de
  2012-09-28 13:04 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenther at suse dot de @ 2012-09-24  8:52 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54345

--- Comment #4 from rguenther at suse dot de <rguenther at suse dot de> 2012-09-24 08:52:06 UTC ---
On Fri, 21 Sep 2012, polacek at redhat dot com wrote:

> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54345
> 
> --- Comment #3 from Marek Polacek <polacek at redhat dot com> 2012-09-21 15:11:08 UTC ---
> Hmm.  I hoped that something like this will show the leak, but no (it does a
> lot of threading with -O2--through conditionals, through loop headers and also
> through latches).  But obviously it's not enough.  Any ideas, please?

ISTR I recognized this on the testcase for PR46590


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

* [Bug tree-optimization/54345] jump threading leaks e->aux heap memory
  2012-08-21 12:27 [Bug tree-optimization/54345] New: jump threading leaks e->aux heap memory rguenth at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2012-09-24  8:52 ` rguenther at suse dot de
@ 2012-09-28 13:04 ` mpolacek at gcc dot gnu.org
  2021-08-14 22:21 ` pinskia at gcc dot gnu.org
  2024-02-20 14:02 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2012-09-28 13:04 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54345

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

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

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> 2012-09-28 13:04:12 UTC ---
Sorry, I'm still not seeing the leak.  Tried testcase in PR46590 as well as in
some other memory-hog bugs, e.g. PR54489.


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

* [Bug tree-optimization/54345] jump threading leaks e->aux heap memory
  2012-08-21 12:27 [Bug tree-optimization/54345] New: jump threading leaks e->aux heap memory rguenth at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2012-09-28 13:04 ` mpolacek at gcc dot gnu.org
@ 2021-08-14 22:21 ` pinskia at gcc dot gnu.org
  2024-02-20 14:02 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-14 22:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
There has been so many changes to this code since GCC 4.8.0 dealing with the
allocations of this pointer.  I can't tell if this has been fixed really.

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

* [Bug tree-optimization/54345] jump threading leaks e->aux heap memory
  2012-08-21 12:27 [Bug tree-optimization/54345] New: jump threading leaks e->aux heap memory rguenth at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-08-14 22:21 ` pinskia at gcc dot gnu.org
@ 2024-02-20 14:02 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-02-20 14:02 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

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

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think this was meanwhile fixed.

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

end of thread, other threads:[~2024-02-20 14:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-21 12:27 [Bug tree-optimization/54345] New: jump threading leaks e->aux heap memory rguenth at gcc dot gnu.org
2012-09-20  8:17 ` [Bug tree-optimization/54345] " polacek at redhat dot com
2012-09-20 11:13 ` rguenther at suse dot de
2012-09-21 15:11 ` polacek at redhat dot com
2012-09-24  8:52 ` rguenther at suse dot de
2012-09-28 13:04 ` mpolacek at gcc dot gnu.org
2021-08-14 22:21 ` pinskia at gcc dot gnu.org
2024-02-20 14:02 ` rguenth 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).