summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2020-03-04 19:02:22 -0500
committerMarek Polacek <polacek@redhat.com>2020-03-04 19:02:22 -0500
commitd8b65123ea2e7f169c3e3972d3942d73f9b3333c (patch)
treebbd938b873e7ae52e1d97f718060fdd099ce2899
parentb38d6242be6aeaf83cdf1f990ff3297a697e4488 (diff)
downloadgcc-d8b65123ea2e7f169c3e3972d3942d73f9b3333c.tar.gz
sanopt: Avoid crash on anonymous parameter [PR93436]
PR sanitizer/93436 * sanopt.c (sanitize_rewrite_addressable_params): Avoid crash on null DECL_NAME.
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/sanopt.c9
2 files changed, 15 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 640d64180f8..e73e1d0fb20 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2020-03-04 Marek Polacek <polacek@redhat.com>
+
+ Backport from mainline
+ 2020-01-26 Marek Polacek <polacek@redhat.com>
+
+ PR sanitizer/93436
+ * sanopt.c (sanitize_rewrite_addressable_params): Avoid crash on
+ null DECL_NAME.
+
2020-03-03 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/94002
diff --git a/gcc/sanopt.c b/gcc/sanopt.c
index 5cb98e1b50e..159d720bc19 100644
--- a/gcc/sanopt.c
+++ b/gcc/sanopt.c
@@ -1170,9 +1170,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));