Browse Source

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));
sbg
Julien Lecoeur 8 years ago committed by Beat Küng
parent
commit
d477b1f0f4
  1. 7
      src/drivers/boards/common/board_crashdump.c

7
src/drivers/boards/common/board_crashdump.c

@ -16,6 +16,11 @@ static void copy_reverse(stack_word_t *dest, stack_word_t *src, int size) @@ -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 @@ -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();

Loading…
Cancel
Save