From 5258ab03cff04ea81d8a34b12b88d6a56988f75f Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 10 Jun 2023 21:02:32 +0200 Subject: [PATCH] compiler failures with gcc 12.x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit a workaround for something that looks like a bug in a compiler. Fixes errors like In file included from /usr/include/c++/12/string:40, from /mnt/server/storage/columnstore/columnstore/utils/funcexp/func_math.cpp:26: In static member function ‘static constexpr std::char_traits::char_type* std::char_traits::copy(char_type*, const char_type*, std::size_t)’, inlined from ‘static constexpr void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_S_copy(_CharT*, const _CharT*, size_type) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator]’ at /usr/include/c++/12/bits/basic_string.h:423:21, inlined from ‘constexpr std::__cxx11::basic_string<_CharT, _Traits, _Allocator>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_M_replace(size_type, size_type, const _CharT*, size_type) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator]’ at /usr/include/c++/12/bits/basic_string.tcc:532:22, inlined from ‘constexpr std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::replace(size_type, size_type, const _CharT*, size_type) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator]’ at /usr/include/c++/12/bits/basic_string.h:2171:19, inlined from ‘constexpr std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _CharT*) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator]’ at /usr/include/c++/12/bits/basic_string.h:1928:22, inlined from ‘virtual std::string funcexp::Func_format::getStrVal(rowgroup::Row&, funcexp::FunctionParm&, bool&, execplan::CalpontSystemCatalog::ColType&)’ at /mnt/server/storage/columnstore/columnstore/utils/funcexp/func_math.cpp:2008:17: /usr/include/c++/12/bits/char_traits.h:431:56: error: ‘void* __builtin_memcpy(void*, const void*, long unsigned int)’ accessing 9223372036854775810 or more bytes at offsets 3 and [2, 2147483645] may overlap up to 9223372036854775813 bytes at offset -3 [-Werror=restrict] 431 | return static_cast(__builtin_memcpy(__s1, __s2, __n ); $ gcc --version gcc (Ubuntu 12.2.0-3ubuntu1) 12.2.0 --- dbcon/execplan/operator.cpp | 6 +++--- utils/funcexp/func_math.cpp | 2 +- utils/funcexp/func_round.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dbcon/execplan/operator.cpp b/dbcon/execplan/operator.cpp index de5101c4d..ef952e0ac 100644 --- a/dbcon/execplan/operator.cpp +++ b/dbcon/execplan/operator.cpp @@ -271,12 +271,12 @@ void Operator::reverseOp() case OP_NE: fOp = OP_EQ; - fData = "="; + fData = '='; break; case OP_GT: fOp = OP_LT; - fData = "<"; + fData = '<'; break; case OP_GE: @@ -286,7 +286,7 @@ void Operator::reverseOp() case OP_LT: fOp = OP_GT; - fData = ">"; + fData = '>'; break; case OP_LE: diff --git a/utils/funcexp/func_math.cpp b/utils/funcexp/func_math.cpp index 7ef56be70..8753991cd 100644 --- a/utils/funcexp/func_math.cpp +++ b/utils/funcexp/func_math.cpp @@ -2005,7 +2005,7 @@ string Func_format::getStrVal(Row& row, FunctionParm& parm, bool& isNull, while ((comma -= 3) > end) { - value.insert(comma, ","); + value.insert(comma, 1, ','); } return value; diff --git a/utils/funcexp/func_round.cpp b/utils/funcexp/func_round.cpp index 9f265f961..967e64f38 100644 --- a/utils/funcexp/func_round.cpp +++ b/utils/funcexp/func_round.cpp @@ -551,7 +551,7 @@ IDB_Decimal Func_round::getDecimalVal(Row& row, FunctionParm& parm, bool& isNull else { if (-s >= (int32_t)value.size()) - value = "0"; + value = '0'; else { // check to see if last digit needs to be rounded up @@ -621,7 +621,7 @@ IDB_Decimal Func_round::getDecimalVal(Row& row, FunctionParm& parm, bool& isNull else { if (-s >= (int32_t)value.size()) - value = "0"; + value = '0'; else { // check to see if last digit needs to be rounded up