[Bug target/67484] options-save.c sanitizer asan detects freed storage referenced heap-use-after-free
ubizjak at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Sep 15 10:09:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67484
--- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Vittorio Zecca from comment #0)
> //to make happy the sanitizer I commented out the for loop in i386.c lines
/* Save the current options unless we are validating options for
#pragma. */
t = build_target_option_node (opts);
opts->x_ix86_arch_string = orig_arch_string;
opts->x_ix86_tune_string = orig_tune_string;
opts_set->x_ix86_fpmath = orig_fpmath_set;
/* Free up memory allocated to hold the strings */
for (i = 0; i < IX86_FUNCTION_SPECIFIC_MAX; i++)
free (option_strings[i]);
Indeed. We saved current options in build_target_option_node, where only
*pointers* to strings were saved. We should not free the memory, pointed by the
saved pointer.
More information about the Gcc-bugs
mailing list