This is an automated email from the ASF dual-hosted git repository.
apitrou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new 61447d95c5 GH-35662: [CI][C++][MinGW] Avoid crash in FormatTwoDigits()
with release build (#35663)
61447d95c5 is described below
commit 61447d95c57a6e416991c383892460e020547c9d
Author: Sutou Kouhei <[email protected]>
AuthorDate: Fri May 19 16:57:40 2023 +0900
GH-35662: [CI][C++][MinGW] Avoid crash in FormatTwoDigits() with release
build (#35663)
### Rationale for this change
I don't know why but the following combination is crashed:
* Template `FormatTwoDigits()` implementation without explicit `inline`
* MinGW
* Release build
### What changes are included in this PR?
This breaks the "template `FormatTwoDigits()` implementation without
explicit `inline`" by specifying `inline` explicitly.
But I don't know why we can avoid this crash by specifying `inline`
explicitly...
### Are these changes tested?
Yes.
### Are there any user-facing changes?
No.
* Closes: #35662
Authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
---
cpp/src/arrow/util/formatting.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/cpp/src/arrow/util/formatting.h b/cpp/src/arrow/util/formatting.h
index 66d8119351..9dcc6463fb 100644
--- a/cpp/src/arrow/util/formatting.h
+++ b/cpp/src/arrow/util/formatting.h
@@ -135,8 +135,12 @@ void FormatOneDigit(Int value, char** cursor) {
FormatOneChar(static_cast<char>('0' + value), cursor);
}
+// GH-35662: I don't know why but the following combination causes SEGV:
+// * template implementation without inline
+// * MinGW
+// * Release build
template <typename Int>
-void FormatTwoDigits(Int value, char** cursor) {
+inline void FormatTwoDigits(Int value, char** cursor) {
assert(value >= 0 && value <= 99);
auto digit_pair = &digit_pairs[value * 2];
FormatOneChar(digit_pair[1], cursor);