diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-09-05 19:43:57 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-09-05 19:43:57 +0000 |
commit | daea048c2c0d6ed6265d2c91e95567da523da927 (patch) | |
tree | 543c12b0c1fc2db620795f0c07b36ef33ac08998 | |
parent | 92a44a68071e46ac8bc265615f441997feeb731e (diff) | |
download | gcc-daea048c2c0d6ed6265d2c91e95567da523da927.tar.gz |
PR sanitizer/77396
* asan/asan_globals.cc: Cherry-pick upstream r280657.
* g++.dg/asan/pr77396-2.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239998 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/asan/pr77396-2.C | 12 | ||||
-rw-r--r-- | libsanitizer/ChangeLog | 5 | ||||
-rw-r--r-- | libsanitizer/asan/asan_globals.cc | 7 |
4 files changed, 26 insertions, 3 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 87e88225382..d7640245e26 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-09-05 Jakub Jelinek <jakub@redhat.com> + + PR sanitizer/77396 + * g++.dg/asan/pr77396-2.C: New test. + 2016-09-05 Uros Bizjak <ubizjak@gmail.com> PR rtl-optimization/77452 diff --git a/gcc/testsuite/g++.dg/asan/pr77396-2.C b/gcc/testsuite/g++.dg/asan/pr77396-2.C new file mode 100644 index 00000000000..0570a14940e --- /dev/null +++ b/gcc/testsuite/g++.dg/asan/pr77396-2.C @@ -0,0 +1,12 @@ +// PR sanitizer/77396 +// { dg-do run } +// { dg-set-target-env-var ASAN_OPTIONS "check_initialization_order=true" } + +struct S { S () { asm volatile ("" : : : "memory"); } }; +static S c; + +int +main () +{ + return 0; +} diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog index d9eb7fa3bd2..a06ab4de7e7 100644 --- a/libsanitizer/ChangeLog +++ b/libsanitizer/ChangeLog @@ -1,3 +1,8 @@ +2016-09-05 Jakub Jelinek <jakub@redhat.com> + + PR sanitizer/77396 + * asan/asan_globals.cc: Cherry-pick upstream r280657. + 2016-08-12 Jakub Jelinek <jakub@redhat.com> PR sanitizer/71042 diff --git a/libsanitizer/asan/asan_globals.cc b/libsanitizer/asan/asan_globals.cc index 9c3588b8e08..f3531cbd133 100644 --- a/libsanitizer/asan/asan_globals.cc +++ b/libsanitizer/asan/asan_globals.cc @@ -248,10 +248,10 @@ void __asan_unregister_globals(__asan_global *globals, uptr n) { // initializer can only touch global variables in the same TU. void __asan_before_dynamic_init(const char *module_name) { if (!flags()->check_initialization_order || - !CanPoisonMemory()) + !CanPoisonMemory() || + !dynamic_init_globals) return; bool strict_init_order = flags()->strict_init_order; - CHECK(dynamic_init_globals); CHECK(module_name); CHECK(asan_inited); BlockingMutexLock lock(&mu_for_globals); @@ -274,7 +274,8 @@ void __asan_before_dynamic_init(const char *module_name) { // TU are poisoned. It simply unpoisons all dynamically initialized globals. void __asan_after_dynamic_init() { if (!flags()->check_initialization_order || - !CanPoisonMemory()) + !CanPoisonMemory() || + !dynamic_init_globals) return; CHECK(asan_inited); BlockingMutexLock lock(&mu_for_globals); |