summaryrefslogtreecommitdiffstats
path: root/src/gtest-death-test.cc
diff options
context:
space:
mode:
authorvladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925>2011-06-13 20:09:57 (GMT)
committervladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925>2011-06-13 20:09:57 (GMT)
commitf3cf0a2316b68cbdc64a00eb61fc8ff955259282 (patch)
tree6afe7654ba11810c67b145c3f5a8dfd352a44534 /src/gtest-death-test.cc
parentcc265df8b44e613ca118ce5da145f91d66f6c440 (diff)
downloadgoogletest-f3cf0a2316b68cbdc64a00eb61fc8ff955259282.zip
googletest-f3cf0a2316b68cbdc64a00eb61fc8ff955259282.tar.gz
googletest-f3cf0a2316b68cbdc64a00eb61fc8ff955259282.tar.bz2
Suppresses the tail-call optimization of StackGrowsDown() in GCC4.6 (by Paul Pluzhnikov).
Diffstat (limited to 'src/gtest-death-test.cc')
-rw-r--r--src/gtest-death-test.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gtest-death-test.cc b/src/gtest-death-test.cc
index 8b2e413..44ff6b2 100644
--- a/src/gtest-death-test.cc
+++ b/src/gtest-death-test.cc
@@ -936,15 +936,17 @@ static int ExecDeathTestChildMain(void* child_arg) {
// GTEST_NO_INLINE_ is required to prevent GCC 4.6 from inlining
// StackLowerThanAddress into StackGrowsDown, which then doesn't give
// correct answer.
-bool StackLowerThanAddress(const void* ptr) GTEST_NO_INLINE_;
-bool StackLowerThanAddress(const void* ptr) {
+void StackLowerThanAddress(const void* ptr, bool* result) GTEST_NO_INLINE_;
+void StackLowerThanAddress(const void* ptr, bool* result) {
int dummy;
- return &dummy < ptr;
+ *result = (&dummy < ptr);
}
bool StackGrowsDown() {
int dummy;
- return StackLowerThanAddress(&dummy);
+ bool result;
+ StackLowerThanAddress(&dummy, &result);
+ return result;
}
// A threadsafe implementation of fork(2) for threadsafe-style death tests