Skip to content

Commit

Permalink
Fix GCC 11 warning: writing 1 byte into a region of size 0 [-Wstringo…
Browse files Browse the repository at this point in the history
…p-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]>
  • Loading branch information
weiting-chen and majetideepak authored Nov 27, 2024
1 parent 74857c2 commit d3e2d4f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
16 changes: 5 additions & 11 deletions velox/common/base/Macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,13 @@

// Macros to disable deprecation warnings
#ifdef __clang__
#define VELOX_SUPPRESS_DEPRECATION_WARNING \
_Pragma("clang diagnostic push"); \
_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
#define VELOX_UNSUPPRESS_DEPRECATION_WARNING _Pragma("clang diagnostic pop");
#define VELOX_SUPPRESS_RETURN_LOCAL_ADDR_WARNING
#define VELOX_UNSUPPRESS_RETURN_LOCAL_ADDR_WARNING
#define VELOX_SUPPRESS_STRINGOP_OVERFLOW_WARNING
#define VELOX_UNSUPPRESS_STRINGOP_OVERFLOW_WARNING
#else
#define VELOX_SUPPRESS_DEPRECATION_WARNING
#define VELOX_UNSUPPRESS_DEPRECATION_WARNING
#define VELOX_SUPPRESS_RETURN_LOCAL_ADDR_WARNING \
#define VELOX_SUPPRESS_STRINGOP_OVERFLOW_WARNING \
_Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Wreturn-local-addr\"")
#define VELOX_UNSUPPRESS_RETURN_LOCAL_ADDR_WARNING \
_Pragma("GCC diagnostic ignored \"-Wstringop-overflow\"")
#define VELOX_UNSUPPRESS_STRINGOP_OVERFLOW_WARNING \
_Pragma("GCC diagnostic pop");
#endif

Expand Down
3 changes: 3 additions & 0 deletions velox/vector/SelectivityVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "velox/buffer/Buffer.h"
#include "velox/common/base/BitUtil.h"
#include "velox/common/base/Exceptions.h"
#include "velox/common/base/Macros.h"
#include "velox/common/base/Range.h"
#include "velox/vector/TypeAliases.h"

Expand Down Expand Up @@ -160,7 +161,9 @@ class SelectivityVector {
bits::fillBits(bits_.data(), 0, size_, false);
begin_ = 0;
end_ = 0;
VELOX_SUPPRESS_STRINGOP_OVERFLOW_WARNING
allSelected_ = false;
VELOX_UNSUPPRESS_STRINGOP_OVERFLOW_WARNING
}

/**
Expand Down

0 comments on commit d3e2d4f

Please sign in to comment.