PR sanitizer/81209
* ubsan.c (ubsan_encode_value): Initialize DECL_CONTEXT on var.
* g++.dg/ubsan/pr81209.C: New test.
From-SVN: r249678
2017-06-27 Jakub Jelinek <jakub@redhat.com>
+ PR sanitizer/81209
+ * ubsan.c (ubsan_encode_value): Initialize DECL_CONTEXT on var.
+
PR middle-end/81207
* gimple-fold.c (replace_call_with_call_and_fold): Handle
gimple_vuse copying separately from gimple_vdef copying.
2017-06-27 Jakub Jelinek <jakub@redhat.com>
+ PR sanitizer/81209
+ * g++.dg/ubsan/pr81209.C: New test.
+
PR middle-end/81207
* gcc.c-torture/compile/pr81207.c: New test.
--- /dev/null
+// PR sanitizer/81209
+// { dg-do compile }
+// { dg-options "-fsanitize=undefined -fno-declone-ctor-dtor" }
+
+#ifdef __SIZEOF_INT128__
+typedef __int128 T;
+#else
+typedef long long int T;
+#endif
+
+struct B {};
+struct A : virtual public B
+{
+ A (long);
+ T a;
+};
+
+A::A (long c)
+{
+ long b = a % c;
+}
{
var = create_tmp_var_raw (type);
TREE_ADDRESSABLE (var) = 1;
+ DECL_CONTEXT (var) = current_function_decl;
}
if (phase == UBSAN_ENCODE_VALUE_RTL)
{