re PR middle-end/92153 (ICE / segmentation fault, use-after-free at gcc/ggc-page...
authorJakub Jelinek <jakub@redhat.com>
Fri, 18 Oct 2019 17:18:21 +0000 (19:18 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 18 Oct 2019 17:18:21 +0000 (19:18 +0200)
PR middle-end/92153
* ggc-page.c (release_pages): Read g->alloc_size before free rather
than after it.

From-SVN: r277157

gcc/ChangeLog
gcc/ggc-page.c

index dda2718a7a04f6839e8c37e2911556f20f3eefe3..724ce8e25c7e0fb8d06619b6234283e6634fc535 100644 (file)
@@ -1,3 +1,9 @@
+2019-10-18  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/92153
+       * ggc-page.c (release_pages): Read g->alloc_size before free rather
+       than after it.
+
 2019-10-18  Andre Vieira  <andre.simoesdiasvieira@arm.com>
 
        * config/arm/t-multilib: Add rule to regenerate mutlilib header file
index 4560206ac2ef2f10ca0229fba1ba47021f4b21e5..a18d7a9d826d268c4cb96b83f67c571dccfb0d46 100644 (file)
@@ -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;