Skip to content
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

Does not compile with GCC 11 #876

Closed
zeroos opened this issue Oct 17, 2021 · 1 comment · Fixed by #877
Closed

Does not compile with GCC 11 #876

zeroos opened this issue Oct 17, 2021 · 1 comment · Fixed by #877
Milestone

Comments

@zeroos
Copy link

zeroos commented Oct 17, 2021

When trying to compile with GCC 11, I get the following error:

../../../crazyflies/crazyflie-firmware/src/deck/core/deck_test.c: In function 'decktestSaveGPIOStatesABC':
../../../crazyflies/crazyflie-firmware/src/deck/core/deck_test.c:61:3: error: 'memcpy' offset [0, 39] is out of the bounds [0, 0] [-Werror=array-bounds]
   61 |   memcpy(&gpioRegBuf->gpioBuffA, GPIOA, sizeof(GPIO_TypeDef));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../crazyflies/crazyflie-firmware/src/deck/core/deck_test.c:62:3: error: 'memcpy' offset [0, 39] is out of the bounds [0, 0] [-Werror=array-bounds]
   62 |   memcpy(&gpioRegBuf->gpioBuffB, GPIOB, sizeof(GPIO_TypeDef));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../crazyflies/crazyflie-firmware/src/deck/core/deck_test.c:63:3: error: 'memcpy' offset [0, 39] is out of the bounds [0, 0] [-Werror=array-bounds]
   63 |   memcpy(&gpioRegBuf->gpioBuffC, GPIOC, sizeof(GPIO_TypeDef));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../crazyflies/crazyflie-firmware/src/deck/core/deck_test.c: In function 'decktestRestoreGPIOStatesABC':
../../../crazyflies/crazyflie-firmware/src/deck/core/deck_test.c:69:3: error: 'memcpy' offset [0, 39] is out of the bounds [0, 0] [-Werror=array-bounds]
   69 |   memcpy(GPIOA, &gpioRegBuf->gpioBuffA, sizeof(GPIO_TypeDef));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../crazyflies/crazyflie-firmware/src/deck/core/deck_test.c:70:3: error: 'memcpy' offset [0, 39] is out of the bounds [0, 0] [-Werror=array-bounds]
   70 |   memcpy(GPIOB, &gpioRegBuf->gpioBuffB, sizeof(GPIO_TypeDef));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../crazyflies/crazyflie-firmware/src/deck/core/deck_test.c:71:3: error: 'memcpy' offset [0, 39] is out of the bounds [0, 0] [-Werror=array-bounds]
   71 |   memcpy(GPIOC, &gpioRegBuf->gpioBuffC, sizeof(GPIO_TypeDef));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [../../../crazyflies/crazyflie-firmware/tools/make/targets.mk:27: deck_test.o] Error 1
make: *** [../../../crazyflies/crazyflie-firmware/Makefile:400: build] Error 2
@zeroos
Copy link
Author

zeroos commented Oct 17, 2021

The discussion here seems related: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578#c1

They suggest that for now, the best solution is to make a compiler skip this check. They suggest two ways to do so. I'll make a PR that disables this warning in Makefile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants