You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gluten.apache.org by "marin-ma (via GitHub)" <gi...@apache.org> on 2025/05/22 08:49:30 UTC
[PR] [VL] Fix VLA error when compiling with apple clang [incubator-gluten]
marin-ma opened a new pull request, #9730:
URL: https://github.com/apache/incubator-gluten/pull/9730
Variable length array is not part of the c++ standard. We should avoid using it in the code.
```
/Users/rong/workspace/github/apache/gluten/cpp/core/jni/JniCommon.h:39:15: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension]
39 | char buffer[clen + 1];
| ^~~~~~~~
/Users/rong/workspace/github/apache/gluten/cpp/core/jni/JniCommon.h:39:15: note: read of non-const variable 'clen' is not allowed in a constant expression
/Users/rong/workspace/github/apache/gluten/cpp/core/jni/JniCommon.h:36:17: note: declared here
36 | int32_t jlen, clen;
| ^
1 error generated.
```
```
/Users/rong/workspace/github/apache/gluten/cpp/velox/operators/serializer/VeloxRowToColumnarConverter.cc:109:26: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension]
109 | uint8_t bytesValue[length];
| ^~~~~~
/Users/rong/workspace/github/apache/gluten/cpp/velox/operators/serializer/VeloxRowToColumnarConverter.cc:109:26: note: read of non-const variable 'length' is not allowed in a constant expression
/Users/rong/workspace/github/apache/gluten/cpp/velox/operators/serializer/VeloxRowToColumnarConverter.cc:107:15: note: declared here
107 | int32_t length = static_cast<int32_t>(offsetAndSize);
| ^
1 error generated.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [VL] Fix VLA error when compiling with apple clang [incubator-gluten]
Posted by "marin-ma (via GitHub)" <gi...@apache.org>.
marin-ma commented on code in PR #9730:
URL: https://github.com/apache/incubator-gluten/pull/9730#discussion_r2103921827
##########
cpp/velox/operators/serializer/VeloxRowToColumnarConverter.cc:
##########
@@ -106,8 +106,8 @@ VectorPtr createFlatVector<TypeKind::HUGEINT>(
int64_t offsetAndSize = *reinterpret_cast<int64_t*>(memoryAddress + offsets[pos] + fieldOffset);
int32_t length = static_cast<int32_t>(offsetAndSize);
int32_t wordoffset = static_cast<int32_t>(offsetAndSize >> 32);
- uint8_t bytesValue[length];
- memcpy(bytesValue, memoryAddress + offsets[pos] + wordoffset, length);
+ std::vector<uint8_t> bytesValue(length);
+ memcpy(bytesValue.data(), memoryAddress + offsets[pos] + wordoffset, length);
Review Comment:
offsetAndSize is 8 bytes, but `length` is a variable extracted from `offsetAndSize`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [VL] Fix VLA error when compiling with apple clang [incubator-gluten]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #9730:
URL: https://github.com/apache/incubator-gluten/pull/9730#issuecomment-2900415260
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICEGJ-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
Thanks for opening a pull request!
Could you open an issue for this pull request on Github Issues?
https://github.com/apache/incubator-gluten/issues
Then could you also rename ***commit message*** and ***pull request title*** in the following format?
[GLUTEN-${ISSUES_ID}][COMPONENT]feat/fix: ${detailed message}
See also:
* [Other pull requests](https://github.com/apache/incubator-gluten/pulls/)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [VL] Fix VLA error when compiling with apple clang [incubator-gluten]
Posted by "marin-ma (via GitHub)" <gi...@apache.org>.
marin-ma merged PR #9730:
URL: https://github.com/apache/incubator-gluten/pull/9730
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [VL] Fix VLA error when compiling with apple clang [incubator-gluten]
Posted by "FelixYBW (via GitHub)" <gi...@apache.org>.
FelixYBW commented on code in PR #9730:
URL: https://github.com/apache/incubator-gluten/pull/9730#discussion_r2103880094
##########
cpp/velox/operators/serializer/VeloxRowToColumnarConverter.cc:
##########
@@ -106,8 +106,8 @@ VectorPtr createFlatVector<TypeKind::HUGEINT>(
int64_t offsetAndSize = *reinterpret_cast<int64_t*>(memoryAddress + offsets[pos] + fieldOffset);
int32_t length = static_cast<int32_t>(offsetAndSize);
int32_t wordoffset = static_cast<int32_t>(offsetAndSize >> 32);
- uint8_t bytesValue[length];
- memcpy(bytesValue, memoryAddress + offsets[pos] + wordoffset, length);
+ std::vector<uint8_t> bytesValue(length);
+ memcpy(bytesValue.data(), memoryAddress + offsets[pos] + wordoffset, length);
Review Comment:
offsetandsize is 8 bytes? right? if so we may needn't use a vector
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org