From 59ab1319cb6664c39d8cf7f05bcf1ec0a625ecdb Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Fri, 9 Dec 2016 19:05:28 +0000 Subject: [PATCH] re PR middle-end/78750 (ICE in get_range_info, at tree-ssanames.c:375) PR middle-end/78750 * builtins.c (check_sizes): Use POINTER_TYPE_P. * g++.dg/torture/pr78750.C: New. From-SVN: r243498 --- gcc/builtins.c | 2 +- gcc/testsuite/g++.dg/torture/pr78750.C | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/torture/pr78750.C diff --git a/gcc/builtins.c b/gcc/builtins.c index 20515e74235..b056e1227ea 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -3091,7 +3091,7 @@ check_sizes (int opt, tree exp, tree size, tree maxlen, tree str, tree objsize) { /* STR is normally a pointer to string but as a special case it can be an integer denoting the length of a string. */ - if (TREE_CODE (TREE_TYPE (str)) == POINTER_TYPE) + if (POINTER_TYPE_P (TREE_TYPE (str))) { /* Try to determine the range of lengths the source string refers to. If it can be determined add one to it for diff --git a/gcc/testsuite/g++.dg/torture/pr78750.C b/gcc/testsuite/g++.dg/torture/pr78750.C new file mode 100644 index 00000000000..54232e6f8ba --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr78750.C @@ -0,0 +1,10 @@ +// PR middle-end/78750 +// { dg-do compile } + +extern "C" char *strcpy (char *, const char *); + +void +fn (char *p, char &as) +{ + strcpy (p, &as); +} -- 2.30.2