You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Ubuntu has released 20.04 LTS which includes GCC 9.3.0. When using this compiler it implements a much stricter (and often over-zealous) checking of string ops.
For instance:
In file included from /usr/include/string.h:495,
from /home/joe/code/cfecfs/github/cfe/fsw/cfe-core/src/es/cfe_es_cds.c:49:
In function ‘strncpy’,
inlined from ‘CFE_ES_RegisterCDSEx’ at /home/joe/code/cfecfs/github/cfe/fsw/cfe-core/src/es/cfe_es_cds.c:299:12:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 38 equals destination size [-Werror=stringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To Reproduce
Build code with default config using GCC 9.3.0, with optimization enabled and full warnings.
Expected behavior
Code should build cleanly.
System observed on:
Ubuntu 20.04 LTS 64 bit.
Additional context
Unfortunately GCC warns about ANY construct which MIGHT truncate, even if truncation is anticipated and handled properly in the code. GCC now declares that one is never allowed to truncate anything in a C library string operation, even if you read the manual and coded it correctly per the C spec, it's still wrong to GCC9.
Reporter Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered:
Ensure clean build, no warnings on string operations using GCC 9.3.0.
Some string ops were genuinely incorrect (particularly in UT) but some
were perfectly OK and handled correctly per the C spec. In particular
the new "rules" that GCC9 warns about make the strncat library function
(and some others) somewhat off-limits even if used correctly.
Ensure clean build, no warnings on string operations using GCC 9.3.0.
Some string ops were genuinely incorrect (particularly in UT) but some
were perfectly OK and handled correctly per the C spec. In particular
the new "rules" that GCC9 warns about make the strncat library function
(and some others) somewhat off-limits even if used correctly.
Describe the bug
Ubuntu has released 20.04 LTS which includes GCC 9.3.0. When using this compiler it implements a much stricter (and often over-zealous) checking of string ops.
For instance:
To Reproduce
Build code with default config using GCC 9.3.0, with optimization enabled and full warnings.
Expected behavior
Code should build cleanly.
System observed on:
Ubuntu 20.04 LTS 64 bit.
Additional context
Unfortunately GCC warns about ANY construct which MIGHT truncate, even if truncation is anticipated and handled properly in the code. GCC now declares that one is never allowed to truncate anything in a C library string operation, even if you read the manual and coded it correctly per the C spec, it's still wrong to GCC9.
Reporter Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered: