aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2010-02-03 16:53:41 -0500
committerJason Merrill <jason@gcc.gnu.org>2010-02-03 16:53:41 -0500
commit2aac192471397a381200ebf29cf92978b97b34b0 (patch)
tree41d1ac72aeb81b278f1eae050004e7b634c0bd65
parentf000c6a763acc0ba0184c5634f2feb3ea883992c (diff)
downloadgcc-2aac192471397a381200ebf29cf92978b97b34b0.zip
gcc-2aac192471397a381200ebf29cf92978b97b34b0.tar.gz
gcc-2aac192471397a381200ebf29cf92978b97b34b0.tar.bz2
re PR c++/40138 (ICE with invalid va_arg)
PR c++/40138 * fold-const.c (operand_equal_p): Handle erroneous types. From-SVN: r156483
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/fold-const.c4
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/ext/builtin11.C9
4 files changed, 20 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e1cb410..e00a388 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2010-02-03 Jason Merrill <jason@redhat.com>
+
+ PR c++/40138
+ * fold-const.c (operand_equal_p): Handle erroneous types.
+
2010-02-01 Kaushik Phatak <kaushik.phatak@kpitcummins.com>
* config/h8300/h8300.md (can_delay): Fix attibute condition.
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index e7a4b8c..292b89f 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -3165,7 +3165,9 @@ int
operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags)
{
/* If either is ERROR_MARK, they aren't equal. */
- if (TREE_CODE (arg0) == ERROR_MARK || TREE_CODE (arg1) == ERROR_MARK)
+ if (TREE_CODE (arg0) == ERROR_MARK || TREE_CODE (arg1) == ERROR_MARK
+ || TREE_TYPE (arg0) == error_mark_node
+ || TREE_TYPE (arg1) == error_mark_node)
return 0;
/* Check equality of integer constants before bailing out due to
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b3fef29..fd84e5e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2010-02-03 Jason Merrill <jason@redhat.com>
+ PR c++/40138
+ * g++.dg/ext/builtin11.C: New.
+
PR c++/4926
PR c++/38600
* g++.dg/abi/mangle35.C: New.
diff --git a/gcc/testsuite/g++.dg/ext/builtin11.C b/gcc/testsuite/g++.dg/ext/builtin11.C
new file mode 100644
index 0000000..2749671
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/builtin11.C
@@ -0,0 +1,9 @@
+// PR c++/40138
+// { dg-options "-Wall" }
+
+void foo(int i, ...)
+{
+ V v; // { dg-error "not declared|expected" }
+ __builtin_va_start(v, i); // { dg-error "not declared" }
+ i = __builtin_va_arg(v, int);
+}