]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/69795 (g++ ICE on invalid code on x86_64-linux-gnu in "reject_gcc_builtin")
authorMarek Polacek <polacek@redhat.com>
Tue, 1 Mar 2016 15:30:42 +0000 (15:30 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Tue, 1 Mar 2016 15:30:42 +0000 (15:30 +0000)
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
gcc/c-family/c-common.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/invalid1.C [new file with mode: 0644]

index 66d74f402abc78cf944534b9cf146448a26f1e83..7a5e323cc4db174f3963055fdcf4f2e020afa8e6 100644 (file)
@@ -1,3 +1,9 @@
+2016-03-01  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/69795
+       * c-common.c (reject_gcc_builtin): Check for FUNCTION_DECL rather than
+       any DECL.
+
 2016-02-22  Martin Sebor  <msebor@redhat.com>
 
        PR middle-end/69780
index 71da6e9b472425b732f67c2ac96bce4052f671fb..22ea7dafe42b9ac757a033fb4edf71eed90d065a 100644 (file)
@@ -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.
index 50991821f2baef38c8887d74ad42343f75c79dc7..27e134fa8a4f3f9ed09fff4f29999b54545a1d78 100644 (file)
@@ -1,3 +1,8 @@
+2016-03-01  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/69795
+       * g++.dg/parse/invalid1.C: New test.
+
 2016-03-01  Richard Biener  <rguenther@suse.de>
 
        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 (file)
index 0000000..f72e277
--- /dev/null
@@ -0,0 +1,5 @@
+// PR c++/69795
+// { dg-do compile { target c++11 } }
+// { dg-options "-w" }
+
+int foo ( foo += *[ // { dg-error "" }