aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-06-30 11:42:54 +0200
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-17 13:15:28 -0300
commit269bee37b973e84f33235a5c1f95e4f4e8f75454 (patch)
tree725a6fc6d3cf19d57a3f36553c3c5a87d1c81d42 /gcc
parentfd84cc0d6c2fd5b80a0f484fe0255c50dea40eaa (diff)
downloadgcc-269bee37b973e84f33235a5c1f95e4f4e8f75454.zip
gcc-269bee37b973e84f33235a5c1f95e4f4e8f75454.tar.gz
gcc-269bee37b973e84f33235a5c1f95e4f4e8f75454.tar.bz2
c-family: Avoid ICEs on calls to internal functions [PR95963]
The following testcase ICEs since recent Martin's -Wnonnull changes, we see a CALL_EXPR and ICE because CALL_EXPR_FN is NULL, which is valid for internal function calls. Internal function calls don't have a function type, and will never have format_arg attribute on them nor will serve as the i18n routines -Wformat cares about. 2020-06-30 Jakub Jelinek <jakub@redhat.com> PR c++/95963 * c-common.c (check_function_arguments_recurse): Don't crash on calls to internal functions. * g++.dg/cpp1z/launder9.C: New test.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-family/c-common.c2
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/launder9.C11
2 files changed, 12 insertions, 1 deletions
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index cfd12c0..aae1ddb 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -5815,7 +5815,7 @@ check_function_arguments_recurse (void (*callback)
return;
}
- if (TREE_CODE (param) == CALL_EXPR)
+ if (TREE_CODE (param) == CALL_EXPR && CALL_EXPR_FN (param))
{
tree type = TREE_TYPE (TREE_TYPE (CALL_EXPR_FN (param)));
tree attrs;
diff --git a/gcc/testsuite/g++.dg/cpp1z/launder9.C b/gcc/testsuite/g++.dg/cpp1z/launder9.C
new file mode 100644
index 0000000..89d7ecf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/launder9.C
@@ -0,0 +1,11 @@
+// PR c++/95963
+// { dg-do compile }
+// { dg-options "-Wnonnull" }
+
+struct A { virtual void foo (); };
+
+void
+bar (A *p)
+{
+ __builtin_launder (p)->foo ();
+}