OSDN Git Service

PR c++/40138
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Feb 2010 21:53:41 +0000 (21:53 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Feb 2010 21:53:41 +0000 (21:53 +0000)
* fold-const.c (operand_equal_p): Handle erroneous types.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156483 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/builtin11.C [new file with mode: 0644]

index e1cb410..e00a388 100644 (file)
@@ -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.
index e7a4b8c..292b89f 100644 (file)
@@ -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
index b3fef29..fd84e5e 100644 (file)
@@ -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 (file)
index 0000000..2749671
--- /dev/null
@@ -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);
+}