From 9e0d2031c32b748eaf3ea89082c0f8658edcbf82 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 18 Oct 2019 19:18:21 +0200 Subject: [PATCH] re PR middle-end/92153 (ICE / segmentation fault, use-after-free at gcc/ggc-page.c:1159) PR middle-end/92153 * ggc-page.c (release_pages): Read g->alloc_size before free rather than after it. From-SVN: r277157 --- gcc/ChangeLog | 6 ++++++ gcc/ggc-page.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dda2718a7a0..724ce8e25c7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-10-18 Jakub Jelinek + + PR middle-end/92153 + * ggc-page.c (release_pages): Read g->alloc_size before free rather + than after it. + 2019-10-18 Andre Vieira * config/arm/t-multilib: Add rule to regenerate mutlilib header file diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c index 4560206ac2e..a18d7a9d826 100644 --- a/gcc/ggc-page.c +++ b/gcc/ggc-page.c @@ -1155,8 +1155,8 @@ release_pages (void) { *gp = g->next; G.bytes_mapped -= g->alloc_size; - free (g->allocation); n1 += g->alloc_size; + free (g->allocation); } else gp = &g->next; -- 2.30.2