-
-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Array bounds warning building Host with GCC 8 #1706
Comments
Closes SmingHub#1706 * Change `memcpy_aligned` to use the non-aligned source data length. On Host platform it's just a regular `memcpy`, but for `Esp8266` we use the aligned length. * Replace custom copying code with a regular `memcpy` call - it's actually faster.
Closes SmingHub#1706 * Change `memcpy_aligned` to use the non-aligned source data length. On Host platform it's just a regular `memcpy`, but for `Esp8266` we use the aligned length. * Replace custom copying code with a regular `memcpy` call - it's actually faster.
Closes SmingHub#1706 * Change `memcpy_aligned` to use the non-aligned source data length. On Host platform it's just a regular `memcpy`, but for `Esp8266` we use the aligned length. * Replace custom copying code with a regular `memcpy` call - it's actually faster.
@frankdownunder Could you give this PR a check to ensure it solves your problem? |
@mikee47 I will do it tomorrow - should I look at |
Thanks, yes that's the one. Did you manage to get anything compiled for Host yet? |
my branch is 'origin/fix/LOAD_PSTR_overrun'. Plus also I got In file included from System/include/debug_progmem.h:20, so some more patches needed for the Libraries it would seem |
If I workaround past those compiler errors, the buid goes on to give me this: C+ Libraries/OneWire/OneWire.cpp |
Tools A little background on the systems I'm using to develop and test: Linux - The Travis build I had to update it was using Windows - Similarly appveyor was running the default MinGW install I would suggest that the above versions are the most likely ones to be found on users' dev systems, certainly for Windows users, so straying too far from those versions and we're likely to run into problems. ==> @frankdownunder For the time being, is it hassle to drop back to 7.4? Libraries These the perhaps the biggest problem facing a migration to Esp32. I checked the Host build against all the libraries and made a spot decision whether to fix or to exclude it. Whilst the libraries may build, ==> May I suggest for the time being just set CI Testing It does appear we get some valuable additional checking using GCC 8+. Should we then add additional builds under those compilers? I say add since it's unsafe to presume that a successful test under, say, gcc 8.3.0 (Feb 19) or even GCC 9 will guarantee we won't have issues with earlier versions. |
@frankdownunder If you're still getting this error, could you do:
Should highlight what's going on |
I did this, still working wit your branch on your fork, and got |
You asked for the time being, is it hassle to drop back to 7.4? |
I've got a suspicion you have |
He for sure does not have
|
I fixed the two issues I mentioned - see PR #1719 |
See #1692 for initial problem report.
The issue is with the
LOAD_PSTR
macro inFakePgmSpace.h
, which copies data from flash to RAM in 4-byte words. Byte-copying from flash is very inefficient so this is an optimisation for the Esp8266.This issue has arised now we can compile the code using more up-to-date tools. From https://gcc.gnu.org/gcc-8/changes.html:
The -Warray-bounds option has been improved to detect more instances of out-of-bounds array indices and pointer offsets. For example, negative or excessive indices into flexible array members and string literals are detected.
This is the output from the pre-processor for the offending code:
We're attempting to do a
memcpy
using the size of the allocated buffer, which is longer than the actual data stored in flash. That doesn't matter on the Esp8266 as we know it's safe to read at least to the next word boundary, but it's not good practice.The text was updated successfully, but these errors were encountered: