This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 0/2 OBV] Fix build with GCC 8


On 11/22/2017 05:21 AM, Yao Qi wrote:
Failed to build GDB and GDBserver with recent GCC trunk, due to some
warnings.  These patches fix the warnings.  Martin had his GDB patch
to fix the build failure, but don't post it here, so I am going to
commit my patches to unbreak the build, because I am GCC trunk to build
GDB mainline everyday.

The implementation of the warning was a work in progress until
yesterday, but the most recent changes should have no impact on
the GDB patch.

The changes do improve GCC's support for detecting unsafe uses
of string functions with non-string arguments (char arrays that
aren't guaranteed to be nul-terminated).  If GDB deals with
character arrays like that it might benefit from making use
of the new attribute nonstring that, besides suppressing
warnings when creating non-nul terminated copies of strings,
also helps detect such unsafe uses.  For example:

  char a[4] __attribute__ ((nonstring));

  strncpy (a, "1234", 4);

  strlen (a);   // unsafe, gets a warning

The attribute has helped uncover a couple of potential bugs
in Glibc.

Martin


Patches are tested on x86_64-linux.

*** BLURB HERE ***

Yao Qi (2):
  Fix build with GCC 8: strncpy -> memcpy
  Fix build with GCC 8: strncpy ->strcpy

 gdb/ChangeLog                | 9 +++++++++
 gdb/cli/cli-decode.c         | 4 ++--
 gdb/cp-namespace.c           | 2 +-
 gdb/gdbserver/ChangeLog      | 4 ++++
 gdb/gdbserver/remote-utils.c | 2 +-
 gdb/python/py-gdb-readline.c | 2 +-
 6 files changed, 18 insertions(+), 5 deletions(-)



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]