Skip to content

Compiler warning when using optimized/release build #970

@jphickey

Description

@jphickey

Describe the bug
A compiler warning pops up when enabling full optimizations:

In function ‘strncpy’,
    inlined from ‘CFE_ES_ReloadApp’ at /home/joe/code/cfecfs/github/cfe/fsw/cfe-core/src/es/cfe_es_api.c:259:12:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 64 equals destination size [-Werror=stringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

To Reproduce
Build with BUILDTYPE=release using a recent GCC (e.g. v9.0+) such as the one with Ubuntu 20.04

Expected behavior
Should build cleanly

System observed on:
Ubuntu 20.04

Reporter Info
Joseph Hickey, Vantage Systems, Inc.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions