Skip to content

Commit d3e2d4f

Browse files
Fix GCC 11 warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=] (facebookincubator#10469) (#507)
Summary: I hit this on ubuntu-22.04 arm64 with GCC11. This was reported in the past as well facebookincubator#9578 Pull Request resolved: facebookincubator#10469 Reviewed By: Yuhta Differential Revision: D59872624 Pulled By: kevinwilfong fbshipit-source-id: 0fa03176dc664121103bf1f521369f1452a990d1 Co-authored-by: Deepak Majeti <[email protected]>
1 parent 74857c2 commit d3e2d4f

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

velox/common/base/Macros.h

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,13 @@
1818

1919
// Macros to disable deprecation warnings
2020
#ifdef __clang__
21-
#define VELOX_SUPPRESS_DEPRECATION_WARNING \
22-
_Pragma("clang diagnostic push"); \
23-
_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
24-
#define VELOX_UNSUPPRESS_DEPRECATION_WARNING _Pragma("clang diagnostic pop");
25-
#define VELOX_SUPPRESS_RETURN_LOCAL_ADDR_WARNING
26-
#define VELOX_UNSUPPRESS_RETURN_LOCAL_ADDR_WARNING
21+
#define VELOX_SUPPRESS_STRINGOP_OVERFLOW_WARNING
22+
#define VELOX_UNSUPPRESS_STRINGOP_OVERFLOW_WARNING
2723
#else
28-
#define VELOX_SUPPRESS_DEPRECATION_WARNING
29-
#define VELOX_UNSUPPRESS_DEPRECATION_WARNING
30-
#define VELOX_SUPPRESS_RETURN_LOCAL_ADDR_WARNING \
24+
#define VELOX_SUPPRESS_STRINGOP_OVERFLOW_WARNING \
3125
_Pragma("GCC diagnostic push"); \
32-
_Pragma("GCC diagnostic ignored \"-Wreturn-local-addr\"")
33-
#define VELOX_UNSUPPRESS_RETURN_LOCAL_ADDR_WARNING \
26+
_Pragma("GCC diagnostic ignored \"-Wstringop-overflow\"")
27+
#define VELOX_UNSUPPRESS_STRINGOP_OVERFLOW_WARNING \
3428
_Pragma("GCC diagnostic pop");
3529
#endif
3630

velox/vector/SelectivityVector.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "velox/buffer/Buffer.h"
2525
#include "velox/common/base/BitUtil.h"
2626
#include "velox/common/base/Exceptions.h"
27+
#include "velox/common/base/Macros.h"
2728
#include "velox/common/base/Range.h"
2829
#include "velox/vector/TypeAliases.h"
2930

@@ -160,7 +161,9 @@ class SelectivityVector {
160161
bits::fillBits(bits_.data(), 0, size_, false);
161162
begin_ = 0;
162163
end_ = 0;
164+
VELOX_SUPPRESS_STRINGOP_OVERFLOW_WARNING
163165
allSelected_ = false;
166+
VELOX_UNSUPPRESS_STRINGOP_OVERFLOW_WARNING
164167
}
165168

166169
/**

0 commit comments

Comments
 (0)