From 5af71a8fde125f3f02c1eef7105bad5b8f6ebcd8 Mon Sep 17 00:00:00 2001 From: dmalcolm Date: Fri, 12 Feb 2016 18:37:35 +0000 Subject: [PATCH] PR driver/69779: fix bogus cleanup code used by libgccjit affecting s390x gcc/ChangeLog: PR driver/69779 * gcc.c (driver::finalize): Fix cleanup of "specs". git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233385 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/gcc.c | 16 ++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 729034caff4b..e783da7aadf2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-02-12 David Malcolm + + PR driver/69779 + * gcc.c (driver::finalize): Fix cleanup of "specs". + 2016-02-12 David Malcolm PR driver/69265 diff --git a/gcc/gcc.c b/gcc/gcc.c index 99fa5e386a5a..eaa465322701 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -9954,8 +9954,20 @@ driver::finalize () multilib_os_dir = 0; multiarch_dir = 0; - XDELETEVEC (specs); - specs = 0; + /* Free any specs dynamically-allocated by set_spec. + These will be at the head of the list, before the + statically-allocated ones. */ + if (specs) + { + while (specs != static_specs) + { + spec_list *next = specs->next; + free (const_cast (specs->name)); + XDELETE (specs); + specs = next; + } + specs = 0; + } for (unsigned i = 0; i < ARRAY_SIZE (static_specs); i++) { spec_list *sl = &static_specs[i]; -- 2.47.3