[tarantool-patches] [PATCH 1/3] Fix: prevent guard-breaker optimization

AKhatskevich avkhatskevich at tarantool.org
Wed Aug 8 14:10:01 MSK 2018


In case of very aggressive optimizations the compiler can
optimize guard-breaker function away and the `unit/guard`
test would fail.
---
 test/unit/guard.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/unit/guard.cc b/test/unit/guard.cc
index 231b44c7d..2082dfd48 100644
--- a/test/unit/guard.cc
+++ b/test/unit/guard.cc
@@ -13,7 +13,7 @@ static int __attribute__((noinline))
 stack_break_f(char *ptr)
 {
 	char block[2048];
-	char sum = 0;
+	volatile char sum = 0;
 	memset(block, 0xff, 2048);
 	sum += block[block[4]];
 	ptrdiff_t stack_diff = ptr > block ? ptr - block : block - ptr;
-- 
2.14.1





More information about the Tarantool-patches mailing list