You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that the compiler sees that the array is only of size 1 and therefore disallows assigning [x + 1], because it is alway out of bounds.
Of course it is never called if there is only one element because we check in the for loop for (size_t i = index; i < m_size - 1; ++i) {, so this should not actually be a problem. But perhaps we need to make that clearer to the compiler somehow.
Sadly I can not reproduce the error on my machine, because I use PlatformIO, so you would need to help me debug potenital solutions if that is okay.
Could you try to reverse the copy statement so instead of in the Array.h fle on Line 170-173:
for (size_t i = index; i < m_size - 1; ++i) {
m_elements[i] = m_elements[i + 1];
}
Can you use this statement instead, perhaps this signals more clearly to the compiler that we never access out of bounds.
for (size_t i = index + 1; i < m_size; ++i) {
m_elements[i - 1] = m_elements[i];
}
Hello, I have upgraded sdk to v0.14.0, I can successfully build when OTA apis isn't included.
Build is not possible when OTA instance is initialized:
Build error:
subscript 1 is above array bounds of 'Attribute_Request_Callback<5> [1]' [-Werror=array-bounds=]
I am able to build if I comment line 171 of Array.h
https://github.com/thingsboard/thingsboard-client-sdk/blob/master/src/Array.h#L171
Environment:
Debug terminal
The text was updated successfully, but these errors were encountered: