Commit c1031852 by Jakub Jelinek Committed by Jakub Jelinek

re PR sanitizer/81209 (-fsanitize=undefined ICE on darwin)

	PR sanitizer/81209
	* ubsan.c (ubsan_encode_value): Initialize DECL_CONTEXT on var.

	* g++.dg/ubsan/pr81209.C: New test.

From-SVN: r249678
parent 00296d7f
2017-06-27 Jakub Jelinek <jakub@redhat.com> 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 PR middle-end/81207
* gimple-fold.c (replace_call_with_call_and_fold): Handle * gimple-fold.c (replace_call_with_call_and_fold): Handle
gimple_vuse copying separately from gimple_vdef copying. gimple_vuse copying separately from gimple_vdef copying.
......
2017-06-27 Jakub Jelinek <jakub@redhat.com> 2017-06-27 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/81209
* g++.dg/ubsan/pr81209.C: New test.
PR middle-end/81207 PR middle-end/81207
* gcc.c-torture/compile/pr81207.c: New test. * gcc.c-torture/compile/pr81207.c: New test.
......
// 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;
}
...@@ -153,6 +153,7 @@ ubsan_encode_value (tree t, enum ubsan_encode_value_phase phase) ...@@ -153,6 +153,7 @@ ubsan_encode_value (tree t, enum ubsan_encode_value_phase phase)
{ {
var = create_tmp_var_raw (type); var = create_tmp_var_raw (type);
TREE_ADDRESSABLE (var) = 1; TREE_ADDRESSABLE (var) = 1;
DECL_CONTEXT (var) = current_function_decl;
} }
if (phase == UBSAN_ENCODE_VALUE_RTL) if (phase == UBSAN_ENCODE_VALUE_RTL)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment