fix: Fix compiler errors in ULTs

Fix warnings that appear
when optimizations in ULTs are enabled:
- `uninitialized` errors
- `free-nonheap-object` errors
- add ignoring `-Wno-maybe-uninitialized` errors for gcc12 Release
builds due to gcc bug
- fix `array-bounds` issue in readLongFileName function
- fix other `array-bounds` errors

Related-To: NEO-8116
Signed-off-by: Kindracki, Jakub Tomasz <jakub.tomasz.kindracki@intel.com>
This commit is contained in:
Kindracki, Jakub Tomasz
2025-09-03 13:28:36 +00:00
committed by Compute-Runtime-Automation
parent 6e6c085145
commit d15aff8679
9 changed files with 38 additions and 53 deletions

View File

@@ -876,13 +876,14 @@ if(NOT MSVC)
endif() endif()
if(CMAKE_BUILD_TYPE STREQUAL "Release") if(CMAKE_BUILD_TYPE STREQUAL "Release")
# Disable specific warnings due to GCC bug for version 12 # Disable specific warnings due to GCC bug for version 12
if(CMAKE_CXX_COMPILER_VERSION STREQUAL "12") if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13)
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105329 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105329
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-restrict") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-restrict")
endif() endif()
# Disable specific warnings due to GCC bug for versions >= 13 # Disable specific warnings due to GCC bug for versions >= 12
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105616 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105616
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105562
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-maybe-uninitialized") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-maybe-uninitialized")
endif() endif()
endif() endif()

View File

@@ -1824,8 +1824,6 @@ HWTEST_F(CommandListCreateTests, givenUnsupportedDescriptorWhenCloneIsCalledThen
auto result = CommandList::cloneAppendKernelExtensions(&ext, outExtPtr); auto result = CommandList::cloneAppendKernelExtensions(&ext, outExtPtr);
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, result); EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, result);
EXPECT_EQ(nullptr, outExtPtr); EXPECT_EQ(nullptr, outExtPtr);
CommandList::freeClonedAppendKernelExtensions(&ext);
} }
} // namespace ult } // namespace ult

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2023-2024 Intel Corporation * Copyright (C) 2023-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -357,7 +357,7 @@ TEST_F(RTASTest, GivenUnderlyingBuilderDestroyFailsThenErrorIsReturned) {
} }
TEST_F(RTASTest, GivenUnderlyingBuilderGetBuildPropertiesSucceedsThenSuccessIsReturned) { TEST_F(RTASTest, GivenUnderlyingBuilderGetBuildPropertiesSucceedsThenSuccessIsReturned) {
RTASBuilder pRTASBuilder; RTASBuilder pRTASBuilder{};
builderGetBuildPropertiesExpImpl = &builderGetBuildProperties; builderGetBuildPropertiesExpImpl = &builderGetBuildProperties;
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeRTASBuilderGetBuildPropertiesExp(pRTASBuilder.toHandle(), nullptr, nullptr)); EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeRTASBuilderGetBuildPropertiesExp(pRTASBuilder.toHandle(), nullptr, nullptr));
@@ -365,7 +365,7 @@ TEST_F(RTASTest, GivenUnderlyingBuilderGetBuildPropertiesSucceedsThenSuccessIsRe
} }
TEST_F(RTASTest, GivenUnderlyingBuilderGetBuildPropertiesFailsThenErrorIsReturned) { TEST_F(RTASTest, GivenUnderlyingBuilderGetBuildPropertiesFailsThenErrorIsReturned) {
RTASBuilder pRTASBuilder; RTASBuilder pRTASBuilder{};
builderGetBuildPropertiesExpImpl = &builderGetBuildPropertiesFail; builderGetBuildPropertiesExpImpl = &builderGetBuildPropertiesFail;
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, L0::zeRTASBuilderGetBuildPropertiesExp(pRTASBuilder.toHandle(), nullptr, nullptr)); EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, L0::zeRTASBuilderGetBuildPropertiesExp(pRTASBuilder.toHandle(), nullptr, nullptr));
@@ -373,8 +373,8 @@ TEST_F(RTASTest, GivenUnderlyingBuilderGetBuildPropertiesFailsThenErrorIsReturne
} }
TEST_F(RTASTest, GivenUnderlyingBuilderBuildSucceedsThenSuccessIsReturned) { TEST_F(RTASTest, GivenUnderlyingBuilderBuildSucceedsThenSuccessIsReturned) {
RTASBuilder pRTASBuilder; RTASBuilder pRTASBuilder{};
RTASParallelOperation pParallelOperation; RTASParallelOperation pParallelOperation{};
builderBuildExpImpl = &builderBuild; builderBuildExpImpl = &builderBuild;
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeRTASBuilderBuildExp(pRTASBuilder.toHandle(), EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeRTASBuilderBuildExp(pRTASBuilder.toHandle(),
@@ -388,8 +388,8 @@ TEST_F(RTASTest, GivenUnderlyingBuilderBuildSucceedsThenSuccessIsReturned) {
} }
TEST_F(RTASTest, GivenUnderlyingBuilderBuildFailsThenErrorIsReturned) { TEST_F(RTASTest, GivenUnderlyingBuilderBuildFailsThenErrorIsReturned) {
RTASBuilder pRTASBuilder; RTASBuilder pRTASBuilder{};
RTASParallelOperation pParallelOperation; RTASParallelOperation pParallelOperation{};
builderBuildExpImpl = &builderBuildFail; builderBuildExpImpl = &builderBuildFail;
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, L0::zeRTASBuilderBuildExp(pRTASBuilder.toHandle(), EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, L0::zeRTASBuilderBuildExp(pRTASBuilder.toHandle(),
@@ -461,7 +461,7 @@ TEST_F(RTASTest, GivenUnderlyingParallelOperationDestroyFailsThenErrorIsReturned
} }
TEST_F(RTASTest, GivenUnderlyingParallelOperationGetPropertiesSucceedsThenSuccessIsReturned) { TEST_F(RTASTest, GivenUnderlyingParallelOperationGetPropertiesSucceedsThenSuccessIsReturned) {
RTASParallelOperation pParallelOperation; RTASParallelOperation pParallelOperation{};
parallelOperationGetPropertiesExpImpl = &parallelOperationGetProperties; parallelOperationGetPropertiesExpImpl = &parallelOperationGetProperties;
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeRTASParallelOperationGetPropertiesExp(pParallelOperation.toHandle(), nullptr)); EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeRTASParallelOperationGetPropertiesExp(pParallelOperation.toHandle(), nullptr));
@@ -469,7 +469,7 @@ TEST_F(RTASTest, GivenUnderlyingParallelOperationGetPropertiesSucceedsThenSucces
} }
TEST_F(RTASTest, GivenUnderlyingParallelOperationGetPropertiesFailsThenErrorIsReturned) { TEST_F(RTASTest, GivenUnderlyingParallelOperationGetPropertiesFailsThenErrorIsReturned) {
RTASParallelOperation pParallelOperation; RTASParallelOperation pParallelOperation{};
parallelOperationGetPropertiesExpImpl = &parallelOperationGetPropertiesFail; parallelOperationGetPropertiesExpImpl = &parallelOperationGetPropertiesFail;
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, L0::zeRTASParallelOperationGetPropertiesExp(pParallelOperation.toHandle(), nullptr)); EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, L0::zeRTASParallelOperationGetPropertiesExp(pParallelOperation.toHandle(), nullptr));
@@ -477,7 +477,7 @@ TEST_F(RTASTest, GivenUnderlyingParallelOperationGetPropertiesFailsThenErrorIsRe
} }
TEST_F(RTASTest, GivenUnderlyingParallelOperationJoinSucceedsThenSuccessIsReturned) { TEST_F(RTASTest, GivenUnderlyingParallelOperationJoinSucceedsThenSuccessIsReturned) {
RTASParallelOperation pParallelOperation; RTASParallelOperation pParallelOperation{};
parallelOperationJoinExpImpl = &parallelOperationJoin; parallelOperationJoinExpImpl = &parallelOperationJoin;
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeRTASParallelOperationJoinExp(pParallelOperation.toHandle())); EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeRTASParallelOperationJoinExp(pParallelOperation.toHandle()));
@@ -485,7 +485,7 @@ TEST_F(RTASTest, GivenUnderlyingParallelOperationJoinSucceedsThenSuccessIsReturn
} }
TEST_F(RTASTest, GivenUnderlyingParallelOperationJoinFailsThenErrorIsReturned) { TEST_F(RTASTest, GivenUnderlyingParallelOperationJoinFailsThenErrorIsReturned) {
RTASParallelOperation pParallelOperation; RTASParallelOperation pParallelOperation{};
parallelOperationJoinExpImpl = &parallelOperationJoinFail; parallelOperationJoinExpImpl = &parallelOperationJoinFail;
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, L0::zeRTASParallelOperationJoinExp(pParallelOperation.toHandle())); EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, L0::zeRTASParallelOperationJoinExp(pParallelOperation.toHandle()));

View File

@@ -412,22 +412,22 @@ TEST_F(RTASTestExt, GivenUnderlyingBuilderDestroyFailsThenErrorIsReturned_Ext) {
} }
TEST_F(RTASTestExt, GivenUnderlyingBuilderGetBuildPropertiesSucceedsThenSuccessIsReturned_Ext) { TEST_F(RTASTestExt, GivenUnderlyingBuilderGetBuildPropertiesSucceedsThenSuccessIsReturned_Ext) {
RTASBuilderExt pRTASBuilderExt; RTASBuilderExt pRTASBuilderExt{};
builderGetBuildPropertiesExtImpl = &builderGetBuildProperties; builderGetBuildPropertiesExtImpl = &builderGetBuildProperties;
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeRTASBuilderGetBuildPropertiesExt(pRTASBuilderExt.toHandle(), nullptr, nullptr)); EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeRTASBuilderGetBuildPropertiesExt(pRTASBuilderExt.toHandle(), nullptr, nullptr));
EXPECT_EQ(1u, builderGetBuildPropertiesCalled); EXPECT_EQ(1u, builderGetBuildPropertiesCalled);
} }
TEST_F(RTASTestExt, GivenUnderlyingBuilderGetBuildPropertiesFailsThenErrorIsReturned_Ext) { TEST_F(RTASTestExt, GivenUnderlyingBuilderGetBuildPropertiesFailsThenErrorIsReturned_Ext) {
RTASBuilderExt pRTASBuilderExt; RTASBuilderExt pRTASBuilderExt{};
builderGetBuildPropertiesExtImpl = &builderGetBuildPropertiesFail; builderGetBuildPropertiesExtImpl = &builderGetBuildPropertiesFail;
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, L0::zeRTASBuilderGetBuildPropertiesExt(pRTASBuilderExt.toHandle(), nullptr, nullptr)); EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, L0::zeRTASBuilderGetBuildPropertiesExt(pRTASBuilderExt.toHandle(), nullptr, nullptr));
EXPECT_EQ(1u, builderGetBuildPropertiesFailCalled); EXPECT_EQ(1u, builderGetBuildPropertiesFailCalled);
} }
TEST_F(RTASTestExt, GivenUnderlyingBuilderBuildSucceedsThenSuccessIsReturned_Ext) { TEST_F(RTASTestExt, GivenUnderlyingBuilderBuildSucceedsThenSuccessIsReturned_Ext) {
RTASBuilderExt pRTASBuilderExt; RTASBuilderExt pRTASBuilderExt{};
RTASParallelOperationExt pParallelOperation; RTASParallelOperationExt pParallelOperation{};
builderBuildExtImpl = &builderBuild; builderBuildExtImpl = &builderBuild;
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeRTASBuilderBuildExt(pRTASBuilderExt.toHandle(), EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeRTASBuilderBuildExt(pRTASBuilderExt.toHandle(),
nullptr, nullptr,
@@ -440,8 +440,8 @@ TEST_F(RTASTestExt, GivenUnderlyingBuilderBuildSucceedsThenSuccessIsReturned_Ext
} }
TEST_F(RTASTestExt, GivenUnderlyingBuilderBuildFailsThenErrorIsReturned_Ext) { TEST_F(RTASTestExt, GivenUnderlyingBuilderBuildFailsThenErrorIsReturned_Ext) {
RTASBuilderExt pRTASBuilderExt; RTASBuilderExt pRTASBuilderExt{};
RTASParallelOperationExt pParallelOperation; RTASParallelOperationExt pParallelOperation{};
builderBuildExtImpl = &builderBuildFail; builderBuildExtImpl = &builderBuildFail;
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, L0::zeRTASBuilderBuildExt(pRTASBuilderExt.toHandle(), EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, L0::zeRTASBuilderBuildExt(pRTASBuilderExt.toHandle(),
nullptr, nullptr,
@@ -505,28 +505,28 @@ TEST_F(RTASTestExt, GivenUnderlyingParallelOperationDestroyFailsThenErrorIsRetur
} }
TEST_F(RTASTestExt, GivenUnderlyingParallelOperationGetPropertiesSucceedsThenSuccessIsReturned_Ext) { TEST_F(RTASTestExt, GivenUnderlyingParallelOperationGetPropertiesSucceedsThenSuccessIsReturned_Ext) {
RTASParallelOperationExt pParallelOperation; RTASParallelOperationExt pParallelOperation{};
parallelOperationGetPropertiesExtImpl = &parallelOperationGetProperties; parallelOperationGetPropertiesExtImpl = &parallelOperationGetProperties;
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeRTASParallelOperationGetPropertiesExt(pParallelOperation.toHandle(), nullptr)); EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeRTASParallelOperationGetPropertiesExt(pParallelOperation.toHandle(), nullptr));
EXPECT_EQ(1u, parallelOperationGetPropertiesCalled); EXPECT_EQ(1u, parallelOperationGetPropertiesCalled);
} }
TEST_F(RTASTestExt, GivenUnderlyingParallelOperationGetPropertiesFailsThenErrorIsReturned_Ext) { TEST_F(RTASTestExt, GivenUnderlyingParallelOperationGetPropertiesFailsThenErrorIsReturned_Ext) {
RTASParallelOperationExt pParallelOperation; RTASParallelOperationExt pParallelOperation{};
parallelOperationGetPropertiesExtImpl = &parallelOperationGetPropertiesFail; parallelOperationGetPropertiesExtImpl = &parallelOperationGetPropertiesFail;
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, L0::zeRTASParallelOperationGetPropertiesExt(pParallelOperation.toHandle(), nullptr)); EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, L0::zeRTASParallelOperationGetPropertiesExt(pParallelOperation.toHandle(), nullptr));
EXPECT_EQ(1u, parallelOperationGetPropertiesFailCalled); EXPECT_EQ(1u, parallelOperationGetPropertiesFailCalled);
} }
TEST_F(RTASTestExt, GivenUnderlyingParallelOperationJoinSucceedsThenSuccessIsReturned_Ext) { TEST_F(RTASTestExt, GivenUnderlyingParallelOperationJoinSucceedsThenSuccessIsReturned_Ext) {
RTASParallelOperationExt pParallelOperation; RTASParallelOperationExt pParallelOperation{};
parallelOperationJoinExtImpl = &parallelOperationJoin; parallelOperationJoinExtImpl = &parallelOperationJoin;
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeRTASParallelOperationJoinExt(pParallelOperation.toHandle())); EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeRTASParallelOperationJoinExt(pParallelOperation.toHandle()));
EXPECT_EQ(1u, parallelOperationJoinCalled); EXPECT_EQ(1u, parallelOperationJoinCalled);
} }
TEST_F(RTASTestExt, GivenUnderlyingParallelOperationJoinFailsThenErrorIsReturned_Ext) { TEST_F(RTASTestExt, GivenUnderlyingParallelOperationJoinFailsThenErrorIsReturned_Ext) {
RTASParallelOperationExt pParallelOperation; RTASParallelOperationExt pParallelOperation{};
parallelOperationJoinExtImpl = &parallelOperationJoinFail; parallelOperationJoinExtImpl = &parallelOperationJoinFail;
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, L0::zeRTASParallelOperationJoinExt(pParallelOperation.toHandle())); EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, L0::zeRTASParallelOperationJoinExt(pParallelOperation.toHandle()));
EXPECT_EQ(1u, parallelOperationJoinFailCalled); EXPECT_EQ(1u, parallelOperationJoinFailCalled);

View File

@@ -600,6 +600,8 @@ HWTEST2_F(MetricIpSamplingCalcOpMultiDevTest, givenIpSamplingMetricGroupThenCrea
calculationDesc.metricGroupCount = 1; calculationDesc.metricGroupCount = 1;
calculationDesc.phMetricGroups = &metricGroupHandle; calculationDesc.phMetricGroups = &metricGroupHandle;
calculationDesc.metricCount = 0;
calculationDesc.phMetrics = nullptr;
zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation; zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation;
EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationCreateExp(context->toHandle(), EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationCreateExp(context->toHandle(),

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2020-2023 Intel Corporation * Copyright (C) 2020-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -72,6 +72,10 @@ inline ConstStringRef readUnpaddedString(const char *paddedString) {
} }
inline ConstStringRef readLongFileName(ConstStringRef longFileNamesSection, size_t offset) { inline ConstStringRef readLongFileName(ConstStringRef longFileNamesSection, size_t offset) {
if (offset > longFileNamesSection.size()) {
offset = longFileNamesSection.size();
}
size_t end = offset; size_t end = offset;
while ((end < longFileNamesSection.size()) && (longFileNamesSection[end] != SpecialFileNames::fileNameTerminator)) { while ((end < longFileNamesSection.size()) && (longFileNamesSection[end] != SpecialFileNames::fileNameTerminator)) {
++end; ++end;

View File

@@ -71,14 +71,8 @@ TEST(ArDecoderReadLongFileName, GivenOffsetThenParsesCorrectString) {
auto name0 = readLongFileName(names, 0U); auto name0 = readLongFileName(names, 0U);
auto name1 = readLongFileName(names, 6U); auto name1 = readLongFileName(names, 6U);
auto name2 = readLongFileName(names, 10U); auto name2 = readLongFileName(names, 10U);
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
auto name3 = readLongFileName(names, 40U); auto name3 = readLongFileName(names, 40U);
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
EXPECT_EQ(names, name0.begin()); EXPECT_EQ(names, name0.begin());
EXPECT_EQ(5U, name0.size()); EXPECT_EQ(5U, name0.size());

View File

@@ -212,16 +212,9 @@ TEST(YamlConsumeNumberOrSign, GivenInvalidCharacterThenReturnCurrentParsePositio
for (int c = std::numeric_limits<char>::min(); c <= std::numeric_limits<char>::max(); ++c) { for (int c = std::numeric_limits<char>::min(); c <= std::numeric_limits<char>::max(); ++c) {
bool isSignOrNumber = NEO::Yaml::isSign(static_cast<char>(c)) || NEO::Yaml::isNumber(static_cast<char>(c)); bool isSignOrNumber = NEO::Yaml::isSign(static_cast<char>(c)) || NEO::Yaml::isNumber(static_cast<char>(c));
char numberStr[2] = {static_cast<char>(c), '\0'}; std::string numberStr(1, static_cast<char>(c));
auto expected = numberStr + (isSignOrNumber ? 1 : 0); auto expected = numberStr.c_str() + (isSignOrNumber ? 1 : 0);
#if defined(__GNUC__) EXPECT_EQ(expected, NEO::Yaml::consumeNumberOrSign(ConstStringRef(numberStr.c_str(), 1), numberStr.c_str())) << c;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
EXPECT_EQ(expected, NEO::Yaml::consumeNumberOrSign(ConstStringRef::fromArray(numberStr), numberStr)) << c;
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
} }
} }

View File

@@ -97,15 +97,8 @@ TEST(KernelArgMetadata, WhenParseTypeQualifiersIsCalledThenQualifierIsProperlyPa
TEST(KernelArgMetadata, WhenParseLimitedStringIsCalledThenReturnedStringDoesntContainExcessiveTrailingZeroes) { TEST(KernelArgMetadata, WhenParseLimitedStringIsCalledThenReturnedStringDoesntContainExcessiveTrailingZeroes) {
char str1[] = "abcd\0\0\0after\0"; char str1[] = "abcd\0\0\0after\0";
#if defined(__GNUC__) EXPECT_STREQ("abcd", NEO::parseLimitedString(str1, strlen(str1)).c_str());
#pragma GCC diagnostic push EXPECT_EQ(4U, NEO::parseLimitedString(str1, strlen(str1)).size());
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
EXPECT_STREQ("abcd", NEO::parseLimitedString(str1, sizeof(str1)).c_str());
EXPECT_EQ(4U, NEO::parseLimitedString(str1, sizeof(str1)).size());
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
EXPECT_STREQ("ab", NEO::parseLimitedString(str1, 2).c_str()); EXPECT_STREQ("ab", NEO::parseLimitedString(str1, 2).c_str());
EXPECT_EQ(2U, NEO::parseLimitedString(str1, 2).size()); EXPECT_EQ(2U, NEO::parseLimitedString(str1, 2).size());