aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2015-11-26 01:52:04 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2015-11-25 18:52:04 -0700
commite82f9ef748f25bbbdc9821efcb287ab1b48dd066 (patch)
tree159f5ccf0d9ca397f77328c86b6fc299fdcf1484
parentae026741df1a3f1dfe86ffde544010027a4c08b1 (diff)
downloadgcc-e82f9ef748f25bbbdc9821efcb287ab1b48dd066.zip
gcc-e82f9ef748f25bbbdc9821efcb287ab1b48dd066.tar.gz
gcc-e82f9ef748f25bbbdc9821efcb287ab1b48dd066.tar.bz2
PR c++/67876 - [6 Regression] ICE when compiling Firefox 38
gcc/cp * pt.c (convert_template_argument): Make sure number of tree operands is greater than zero before attempting to extract one. gcc/testsuite/ * g++.dg/pr67876.C: New test. From-SVN: r230924
-rw-r--r--gcc/cp/ChangeLog10
-rw-r--r--gcc/cp/pt.c1
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/pr67876.C32
4 files changed, 46 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 52ca12f..82a29a3 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2015-11-25 Martin Sebor <msebor@redhat.com>
+
+ PR c++/67876
+ * pt.c (convert_template_argument): Make sure number of tree
+ operands is greater than zero before attempting to extract one.
+
2015-11-25 Ryan Burn <contact@rnburn.com>
PR c++/68434
@@ -369,10 +375,10 @@
(cp_parser_pragma): Adjust omp_declare_simd checking. Call
cp_ensure_no_oacc_routine.
(cp_parser_pragma): Add OpenACC routine handling.
-
+
2015-11-08 Martin Sebor <msebor@redhat.com>
- PR c++/67942
+ PR c++/67942
* cp/init.c (warn_placement_new_too_small): Convert integer
operand of POINTER_PLUS_EXPR to ssize_t to determine its signed
value.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 2432283..5befd64 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -7234,6 +7234,7 @@ convert_template_argument (tree parm,
if (TREE_CODE (TREE_TYPE (inner)) == REFERENCE_TYPE
&& TREE_CODE (TREE_TYPE (TREE_TYPE (inner))) == FUNCTION_TYPE
&& TREE_CODE (TREE_TYPE (inner)) == REFERENCE_TYPE
+ && 0 < TREE_OPERAND_LENGTH (inner)
&& reject_gcc_builtin (TREE_OPERAND (inner, 0)))
return error_mark_node;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 41804b9..9d022fc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-11-25 Martin Sebor <msebor@redhat.com>
+
+ PR c++/67876
+ * g++.dg/pr67876.C: New test.
+
2015-11-25 Aditya Kumar <aditya.k7@samsung.com>
Sebastian Pop <s.pop@samsung.com>
diff --git a/gcc/testsuite/g++.dg/pr67876.C b/gcc/testsuite/g++.dg/pr67876.C
new file mode 100644
index 0000000..5d62b5a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr67876.C
@@ -0,0 +1,32 @@
+// PR c++/67876 - [6 Regression] ICE when compiling Firefox 38
+// Caused by a patch for c/66516 - missing diagnostic on taking
+// the address of a builtin function
+// { dg-do compile }
+
+template <class T, void (&F)(T*)>
+struct S { };
+
+extern void foo (int*);
+
+template <class T, void (&F)(T*)>
+void bar (S<T, F>&s) { }
+
+S<int, foo> s;
+
+void foobar (S<int, foo> &s) { bar (s); }
+// PR c++/67876 - [6 Regression] ICE when compiling Firefox 38
+// Caused by a patch for c/66516 - missing diagnostic on taking
+// the address of a builtin function
+// { dg-do compile }
+
+template <class T, void (&F)(T*)>
+struct S { };
+
+extern void foo (int*);
+
+template <class T, void (&F)(T*)>
+void bar (S<T, F>&s) { }
+
+S<int, foo> s;
+
+void foobar (S<int, foo> &s) { bar (s); }