Skip to content

Commit 5a897b0

Browse files
committed
test: work around clang optimizer bug on aarch64
1 parent 1e85a8d commit 5a897b0

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

test/global_metadata_test.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ TEST_F(global_metadata_test, check_empty_tables) {
7070
EXPECT_THAT([&] { check(raw); }, throws_error("empty modes table"));
7171
}
7272

73+
// On aarch64, Clang will wrongly optimize away some of the assignments
74+
// in this test, leading to false positives. I'm pretty sure this is a bug
75+
// in Clang, need to reproduce it and file a bug report.
76+
#if defined(__clang__) && defined(__aarch64__)
77+
#pragma clang optimize off
78+
#endif
79+
7380
TEST_F(global_metadata_test, check_index_range) {
7481
metadata raw;
7582
raw.directories()->resize(1);
@@ -138,6 +145,10 @@ TEST_F(global_metadata_test, check_index_range) {
138145
EXPECT_THAT([&] { check(raw); }, throws_error("inode_num out of range"));
139146
}
140147

148+
#if defined(__clang__) && defined(__aarch64__)
149+
#pragma clang optimize on
150+
#endif
151+
141152
TEST_F(global_metadata_test, check_packed_tables) {
142153
metadata raw;
143154
raw.inodes()->resize(2);

0 commit comments

Comments
 (0)