From 1be56bc54224b8e74c7596d243e24659970876b9 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Tue, 1 Mar 2016 15:30:42 +0000 Subject: [PATCH] re PR c++/69795 (g++ ICE on invalid code on x86_64-linux-gnu in "reject_gcc_builtin") PR c++/69795 * c-common.c (reject_gcc_builtin): Check for FUNCTION_DECL rather than any DECL. * g++.dg/parse/invalid1.C: New test. From-SVN: r233855 --- gcc/c-family/ChangeLog | 6 ++++++ gcc/c-family/c-common.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/parse/invalid1.C | 5 +++++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/parse/invalid1.C diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 66d74f402abc..7a5e323cc4db 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2016-03-01 Marek Polacek + + PR c++/69795 + * c-common.c (reject_gcc_builtin): Check for FUNCTION_DECL rather than + any DECL. + 2016-02-22 Martin Sebor PR middle-end/69780 diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 71da6e9b4724..22ea7dafe42b 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -12638,7 +12638,7 @@ reject_gcc_builtin (const_tree expr, location_t loc /* = UNKNOWN_LOCATION */) if (TREE_TYPE (expr) && TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE - && DECL_P (expr) + && TREE_CODE (expr) == FUNCTION_DECL /* The intersection of DECL_BUILT_IN and DECL_IS_BUILTIN avoids false positives for user-declared built-ins such as abs or strlen, and for C++ operators new and delete. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 50991821f2ba..27e134fa8a4f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-03-01 Marek Polacek + + PR c++/69795 + * g++.dg/parse/invalid1.C: New test. + 2016-03-01 Richard Biener PR middle-end/70022 diff --git a/gcc/testsuite/g++.dg/parse/invalid1.C b/gcc/testsuite/g++.dg/parse/invalid1.C new file mode 100644 index 000000000000..f72e277488d6 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/invalid1.C @@ -0,0 +1,5 @@ +// PR c++/69795 +// { dg-do compile { target c++11 } } +// { dg-options "-w" } + +int foo ( foo += *[ // { dg-error "" }