aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2016-02-12 18:37:35 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2016-02-12 18:37:35 +0000
commit8dccd19b3be7d3b94c6d3e0cbc7674d12314e909 (patch)
tree0ca55fb63f196338796acc38bea4175d8353bda3
parent61789eedf831541b415691f7376a83fa81e6d73b (diff)
downloadgcc-8dccd19b3be7d3b94c6d3e0cbc7674d12314e909.zip
gcc-8dccd19b3be7d3b94c6d3e0cbc7674d12314e909.tar.gz
gcc-8dccd19b3be7d3b94c6d3e0cbc7674d12314e909.tar.bz2
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". From-SVN: r233385
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/gcc.c16
2 files changed, 19 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 729034c..e783da7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2016-02-12 David Malcolm <dmalcolm@redhat.com>
+ PR driver/69779
+ * gcc.c (driver::finalize): Fix cleanup of "specs".
+
+2016-02-12 David Malcolm <dmalcolm@redhat.com>
+
PR driver/69265
PR driver/69453
* gcc.c (driver::driver): Initialize m_option_suggestions.
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 99fa5e3..eaa4653 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 <char *> (specs->name));
+ XDELETE (specs);
+ specs = next;
+ }
+ specs = 0;
+ }
for (unsigned i = 0; i < ARRAY_SIZE (static_specs); i++)
{
spec_list *sl = &static_specs[i];