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

Many string truncation warnings with newer GCC #156

Closed
jphickey opened this issue Apr 27, 2020 · 0 comments · Fixed by #157 or #160
Closed

Many string truncation warnings with newer GCC #156

jphickey opened this issue Apr 27, 2020 · 0 comments · Fixed by #157 or #160
Milestone

Comments

@jphickey
Copy link
Contributor

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/psp/fsw/pc-linux/src/cfe_psp_start.c:37:
In function ‘strncpy’,
    inlined from ‘CFE_PSP_ProcessArgumentDefaults’ at /home/joe/code/cfecfs/github/psp/fsw/pc-linux/src/cfe_psp_start.c:524:7:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 32 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.

Reporter Info
Joseph Hickey, Vantage Systems, Inc.

jphickey added a commit to jphickey/PSP that referenced this issue Apr 27, 2020
Fix possible non-termination of strings in command line option parsing.
These generated warnings in GCC9.
astrogeco added a commit that referenced this issue May 8, 2020
@astrogeco astrogeco added this to the 1.5.0 milestone Oct 1, 2020
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