summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIndu Bhagat <indu.bhagat@oracle.com>2021-05-31 09:19:38 -0700
committerIndu Bhagat <indu.bhagat@oracle.com>2021-05-31 09:19:38 -0700
commita87efd32384ee78ee33d20703deaa65fba81cb2d (patch)
treef2157c54837d66a94afc0ad5ddfd82e4ce329656
parentbdf1a4026a2517fada8ee4e8b6f114295f69ef26 (diff)
downloadgcc-a87efd32384ee78ee33d20703deaa65fba81cb2d.tar.gz
PR testsuite/100749 - gcc.dg/pch/valid-1.c fails after r12-949
Fix failing pch testcases. Use xstrdup to retain a reliable copy of the debug format str containing the names (df_set_names is a static string var). 2021-05-31 Indu Bhagat <indu.bhagat@oracle.com> gcc/c-family/ PR testsuite/100749 * c-pch.c (c_common_valid_pch): Use xstrdup for debug format set names.
-rw-r--r--gcc/c-family/c-pch.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/c-family/c-pch.c b/gcc/c-family/c-pch.c
index 8f0f76024a2..5da60423354 100644
--- a/gcc/c-family/c-pch.c
+++ b/gcc/c-family/c-pch.c
@@ -255,10 +255,13 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd)
if (v.pch_write_symbols != write_symbols
&& write_symbols != NO_DEBUG)
{
+ char *created_str = xstrdup (debug_set_names (v.pch_write_symbols));
+ char *used_str = xstrdup (debug_set_names (write_symbols));
cpp_warning (pfile, CPP_W_INVALID_PCH,
"%s: created with '%s' debug info, but used with '%s'", name,
- debug_set_names (v.pch_write_symbols),
- debug_set_names (write_symbols));
+ created_str, used_str);
+ free (created_str);
+ free (used_str);
return 2;
}