aboutsummaryrefslogtreecommitdiff
path: root/libsanitizer
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-09-05 21:43:57 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2016-09-05 21:43:57 +0200
commit0ce483917ffb79cf25d633e2dbe01a678437133e (patch)
tree543c12b0c1fc2db620795f0c07b36ef33ac08998 /libsanitizer
parent3f8257db2ecfb4eaaf895d2a92d1f499fcfa688f (diff)
downloadgcc-0ce483917ffb79cf25d633e2dbe01a678437133e.zip
gcc-0ce483917ffb79cf25d633e2dbe01a678437133e.tar.gz
gcc-0ce483917ffb79cf25d633e2dbe01a678437133e.tar.bz2
re PR sanitizer/77396 (address sanitizer crashes if all static global variables are optimized)
PR sanitizer/77396 * asan/asan_globals.cc: Cherry-pick upstream r280657. * g++.dg/asan/pr77396-2.C: New test. From-SVN: r239998
Diffstat (limited to 'libsanitizer')
-rw-r--r--libsanitizer/ChangeLog5
-rw-r--r--libsanitizer/asan/asan_globals.cc7
2 files changed, 9 insertions, 3 deletions
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog
index d9eb7fa..a06ab4d 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 9c3588b..f3531cb 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);