I am doing experiment with c++20, and need g++10, so i went over this bug :
Code: Select all
In function 'dyn_create_object_heap',
inlined from 'dyn_create_object_heap' at ../../../ChibiOS_20.3_stable/os/oslib/src/chfactory.c:124:23:
../../../ChibiOS_20.3_stable/os/oslib/src/chfactory.c:146:3: error: 'strncpy' specified bound 8 equals destination size [-Werror=stringop-truncation]
146 | strncpy(dep->name, name, CH_CFG_FACTORY_MAX_NAMES_LENGTH);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Compiling chcore.c
Compiling chcore_v7m.c
In function 'dyn_create_object_pool',
inlined from 'dyn_create_object_pool' at ../../../ChibiOS_20.3_stable/os/oslib/src/chfactory.c:172:23:
../../../ChibiOS_20.3_stable/os/oslib/src/chfactory.c:194:3: error: 'strncpy' specified bound 8 equals destination size [-Werror=stringop-truncation]
194 | strncpy(dep->name, name, CH_CFG_FACTORY_MAX_NAMES_LENGTH);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
If it's OK that dep->name is not null terminated when length is equal to CH_CFG_FACTORY_MAX_NAMES_LENGTH, it's a false positive.
Probably a new check that gcc10 does.
Alexandre