mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 15:28:53 +08:00
Fix -Werror=stringop-overflow on gcc 7
This prevents the compiler from optimising pdump. The error was: Firmware/src/drivers/boards/common/board_crashdump.c:41:2: error: 'memset' writing 3240 bytes into a region of size 4 overflows the destination [-Werror=stringop-overflow=] memset(pdump, 0, sizeof(fullcontext_s));
This commit is contained in:
committed by
Beat Küng
parent
4349f49610
commit
d477b1f0f4
@@ -16,6 +16,11 @@ static void copy_reverse(stack_word_t *dest, stack_word_t *src, int size)
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t *__attribute__((noinline)) __sdata_addr(void)
|
||||
{
|
||||
return &_sdata;
|
||||
}
|
||||
|
||||
__EXPORT void board_crashdump(uintptr_t currentsp, FAR void *tcb, FAR const uint8_t *filename, int lineno)
|
||||
{
|
||||
/* We need a chunk of ram to save the complete context in.
|
||||
@@ -25,7 +30,7 @@ __EXPORT void board_crashdump(uintptr_t currentsp, FAR void *tcb, FAR const uint
|
||||
* Unfortunately this is hard to test. See dead below
|
||||
*/
|
||||
|
||||
fullcontext_s *pdump = (fullcontext_s *)&_sdata;
|
||||
fullcontext_s *pdump = (fullcontext_s *)__sdata_addr();
|
||||
|
||||
(void)enter_critical_section();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user