aboutsummaryrefslogtreecommitdiff
path: root/gcc/sanopt.c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2020-01-25 19:02:11 -0500
committerMarek Polacek <polacek@redhat.com>2020-01-26 16:28:10 -0500
commitab6cd364eda21d3d24a4df0072c588cc68ff61e0 (patch)
treeab08fa95625145dba6e879f6cc3180f3cae833b0 /gcc/sanopt.c
parent8022264265dd39887a1723eeda8ae445afad1fde (diff)
downloadgcc-ab6cd364eda21d3d24a4df0072c588cc68ff61e0.zip
gcc-ab6cd364eda21d3d24a4df0072c588cc68ff61e0.tar.gz
gcc-ab6cd364eda21d3d24a4df0072c588cc68ff61e0.tar.bz2
sanopt: Avoid crash on anonymous parameter [PR93436]
Here we crash when using -fsanitize=address -fdump-tree-sanopt because the dumping code uses IDENTIFIER_POINTER on a null DECL_NAME. Instead, we can print "<anonymous>" in such a case. Or we could avoid printing that diagnostic altogether. 2020-01-26 Marek Polacek <polacek@redhat.com> PR tree-optimization/93436 * sanopt.c (sanitize_rewrite_addressable_params): Avoid crash on null DECL_NAME.
Diffstat (limited to 'gcc/sanopt.c')
-rw-r--r--gcc/sanopt.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/sanopt.c b/gcc/sanopt.c
index 619aae4..0788eef 100644
--- a/gcc/sanopt.c
+++ b/gcc/sanopt.c
@@ -1174,9 +1174,12 @@ sanitize_rewrite_addressable_params (function *fun)
continue;
if (dump_file)
- fprintf (dump_file,
- "Rewriting parameter whose address is taken: %s\n",
- IDENTIFIER_POINTER (DECL_NAME (arg)));
+ {
+ fprintf (dump_file,
+ "Rewriting parameter whose address is taken: ");
+ print_generic_expr (dump_file, arg, dump_flags);
+ fputc ('\n', dump_file);
+ }
SET_DECL_PT_UID (var, DECL_PT_UID (arg));