aboutsummaryrefslogtreecommitdiffstats
path: root/testing/watchman/e77eb9597c4c094a0b0bbeef0b957b49b40b87eb.patch
blob: 17288fef58eea6f1c6b4e5e4436e80db6fc9ce63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
From e77eb9597c4c094a0b0bbeef0b957b49b40b87eb Mon Sep 17 00:00:00 2001
From: Wez Furlong <wez@fb.com>
Date: Mon, 8 Jan 2018 21:57:43 -0800
Subject: [PATCH] fix art.t test failure on alpine linux

Summary:
Looks like we end up with root_ holding a nullptr after
the associated test is finished.  This only seems to be a problem
in practice on Alpine linux's musl libc based environment, and
only when built with `-O2`.  Not sure if this is a c++ standard
library implementation issue or a compiler optimization, or a
combination of both of those things.

Guard against that with a simple nullptr check.

Refs https://github.com/facebook/watchman/issues/546

Reviewed By: simpkins

Differential Revision: D6681244

fbshipit-source-id: f119b3552c0aeedc325fa83c71b12745536b1dac
---
 thirdparty/libart/src/art-inl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/thirdparty/libart/src/art-inl.h b/thirdparty/libart/src/art-inl.h
index fce055be..acc7cd67 100644
--- a/thirdparty/libart/src/art-inl.h
+++ b/thirdparty/libart/src/art-inl.h
@@ -760,7 +760,7 @@ art_tree<ValueType, KeyType>::Node::maximum() const {
 template <typename ValueType, typename KeyType>
 typename art_tree<ValueType, KeyType>::Leaf*
 art_tree<ValueType, KeyType>::minimum() const {
-  return root_->minimum();
+  return root_ ? root_->minimum() : nullptr;
 }
 
 /**
@@ -769,7 +769,7 @@ art_tree<ValueType, KeyType>::minimum() const {
 template <typename ValueType, typename KeyType>
 typename art_tree<ValueType, KeyType>::Leaf*
 art_tree<ValueType, KeyType>::maximum() const {
-  return root_->maximum();
+  return root_ ? root_->maximum() : nullptr;
 }
 
 template <typename ValueType, typename KeyType>