Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-09-01 12:11:12 +0300
committerJacques Lucke <jacques@blender.org>2020-09-01 12:11:21 +0300
commit114150e80c43eb2f3e7e0f70ec6e25e29cf28984 (patch)
tree3076e9bcacbe554deb0d7f7773c566ecffb81a79 /source
parent1449ae042ef2556192e5f9b4ea85348e1fa81a3f (diff)
Fix compilation error with -Werror=array-bounds
This error happened only with O2 or O3 in my tests. Casting to uintptr_t and back seems to quiet the compiler.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenlib/tests/BLI_span_test.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/blenlib/tests/BLI_span_test.cc b/source/blender/blenlib/tests/BLI_span_test.cc
index 82d21e53084..9a8d9df7873 100644
--- a/source/blender/blenlib/tests/BLI_span_test.cc
+++ b/source/blender/blenlib/tests/BLI_span_test.cc
@@ -237,7 +237,8 @@ TEST(span, ContainsPtr)
EXPECT_TRUE(a_span.contains_ptr(&a[0] + 1));
EXPECT_TRUE(a_span.contains_ptr(&a[0] + 2));
EXPECT_FALSE(a_span.contains_ptr(&a[0] + 3));
- EXPECT_FALSE(a_span.contains_ptr(&a[0] - 1));
+ int *ptr_before = reinterpret_cast<int *>(reinterpret_cast<uintptr_t>(a.data()) - 1);
+ EXPECT_FALSE(a_span.contains_ptr(ptr_before));
EXPECT_FALSE(a_span.contains_ptr(&other));
}