This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[committed] Fix memory leak in oacc code (PR middle-end/79505)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Chung-Lin Tang <cltang at codesourcery dot com>, Cesar Philippidis <cesar at codesourcery dot com>, Thomas Schwinge <thomas at codesourcery dot com>
- Date: Tue, 14 Feb 2017 20:43:10 +0100
- Subject: [committed] Fix memory leak in oacc code (PR middle-end/79505)
- Authentication-results: sourceware.org; auth=none
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
We leak the loop->ifns vectors, fixed thusly, bootstrapped/regtested on
x86_64-linux and i686-linux, committed to trunk.
The first 2 hunks are just cleanup, loop is allocated using XCNEW and thus
cleared, no need to clear anything again (especially when it isn't all
but just random subset of the fields).
2017-02-14 Jakub Jelinek <jakub@redhat.com>
PR middle-end/79505
* omp-offload.c (free_oacc_loop): Release loop->ifns vector.
(new_oacc_loop_raw): Don't clear already cleared fields.
--- gcc/omp-offload.c.jj 2017-02-09 16:16:01.000000000 +0100
+++ gcc/omp-offload.c 2017-02-14 13:23:24.198091131 +0100
@@ -681,7 +681,6 @@ new_oacc_loop_raw (oacc_loop *parent, lo
oacc_loop *loop = XCNEW (oacc_loop);
loop->parent = parent;
- loop->child = loop->sibling = NULL;
if (parent)
{
@@ -690,15 +689,6 @@ new_oacc_loop_raw (oacc_loop *parent, lo
}
loop->loc = loc;
- loop->marker = NULL;
- memset (loop->heads, 0, sizeof (loop->heads));
- memset (loop->tails, 0, sizeof (loop->tails));
- loop->routine = NULL_TREE;
-
- loop->mask = loop->e_mask = loop->flags = loop->inner = 0;
- loop->chunk_size = 0;
- loop->head_end = NULL;
-
return loop;
}
@@ -773,6 +763,7 @@ free_oacc_loop (oacc_loop *loop)
if (loop->child)
free_oacc_loop (loop->child);
+ loop->ifns.release ();
free (loop);
}
Jakub