From 11b9b5a445074aaef7a8b8961dcfb62f79168777 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Fri, 11 Dec 2015 11:59:29 +0100 Subject: [PATCH] re PR target/67484 (options-save.c sanitizer asan detects freed storage referenced heap-use-after-free) Fix PR target/67484 Uros Bizjak PR target/67484 * config/i386/i386.c (ix86_valid_target_attribute_tree): Use ggc_strdup to copy option_strings to opts->x_ix86_arch_string and opts->x_ix86_tune_string. From-SVN: r231556 --- gcc/ChangeLog | 9 +++++++++ gcc/config/i386/i386.c | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c150e00dc3e..de877d493c9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2015-12-11 Martin Liska + + Uros Bizjak + + PR target/67484 + * config/i386/i386.c (ix86_valid_target_attribute_tree): + Use ggc_strdup to copy option_strings to opts->x_ix86_arch_string and + opts->x_ix86_tune_string. + 2015-12-11 Richard Biener * lto-streamer.h (lto_simple_header_with_strings): Remove diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index e565c0bc643..cecea2496a9 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -6152,7 +6152,7 @@ ix86_valid_target_attribute_tree (tree args, if (option_strings[IX86_FUNCTION_SPECIFIC_ARCH]) { opts->x_ix86_arch_string - = option_strings[IX86_FUNCTION_SPECIFIC_ARCH]; + = ggc_strdup (option_strings[IX86_FUNCTION_SPECIFIC_ARCH]); /* If arch= is set, clear all bits in x_ix86_isa_flags, except for ISA_64BIT, ABI_64, ABI_X32, and CODE16. */ @@ -6166,7 +6166,8 @@ ix86_valid_target_attribute_tree (tree args, opts->x_ix86_arch_string = NULL; if (option_strings[IX86_FUNCTION_SPECIFIC_TUNE]) - opts->x_ix86_tune_string = option_strings[IX86_FUNCTION_SPECIFIC_TUNE]; + opts->x_ix86_tune_string + = ggc_strdup (option_strings[IX86_FUNCTION_SPECIFIC_TUNE]); else if (orig_tune_defaulted) opts->x_ix86_tune_string = NULL; -- 2.30.2