+2016-03-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/70084
+ * tree-inline.c (copy_tree_body_r): When cancelling ADDR_EXPR
+ of INDIRECT_REF and ADDR_EXPR changed type, fold_convert it
+ to the right type.
+
2016-03-04 Bernd Schmidt <bschmidt@redhat.com>
PR c/69973
+2016-03-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/70084
+ * g++.dg/expr/stdarg3.C: New test.
+
2016-03-04 Jeff Law <law@redhat.com>
PR tree-optimization/69196
--- /dev/null
+// PR c++/70084
+// { dg-do compile }
+
+#include <stdarg.h>
+
+struct A
+{
+ A (const char *f, ...);
+};
+
+A::A (const char *f, ...)
+{
+ va_list ap;
+ va_start (ap, f);
+ int i = va_arg (ap, int); // { dg-bogus "first argument to 'va_arg' not of type 'va_list'" }
+ int j = va_arg ((ap), int); // { dg-bogus "first argument to 'va_arg' not of type 'va_list'" }
+ va_end (ap);
+}
/* Handle the case where we substituted an INDIRECT_REF
into the operand of the ADDR_EXPR. */
if (TREE_CODE (TREE_OPERAND (*tp, 0)) == INDIRECT_REF)
- *tp = TREE_OPERAND (TREE_OPERAND (*tp, 0), 0);
+ {
+ tree t = TREE_OPERAND (TREE_OPERAND (*tp, 0), 0);
+ if (TREE_TYPE (t) != TREE_TYPE (*tp))
+ t = fold_convert (remap_type (TREE_TYPE (*tp), id), t);
+ *tp = t;
+ }
else
recompute_tree_invariant_for_addr_expr (*tp);