This is the mail archive of the
mailing list for the GCC project.
Re: RFA: libiberty: avoid UBSAN complaint in cplus-dem.c
- From: "Ian Lance Taylor via gcc-patches" <gcc-patches at gcc dot gnu dot org>
- To: Tom Tromey <tom at tromey dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 27 Jul 2018 13:18:19 -0700
- Subject: Re: RFA: libiberty: avoid UBSAN complaint in cplus-dem.c
- References: <firstname.lastname@example.org>
- Reply-to: Ian Lance Taylor <iant at google dot com>
On Fri, Jul 27, 2018 at 10:12 AM, Tom Tromey <email@example.com> wrote:
> I built gdb with -fsanitize=undefined, and there was a complaint coming
> from cplus-dem.c. remember_Btype can call memcpy with a NULL pointer,
> which is undefined behavior according to the C standard.
> This patch fixes the problem for me. I tested this by rebuilding gdb
> (with -fsanitize=undefined) and re-running the test suite.
> 2018-07-27 Tom Tromey <firstname.lastname@example.org>
> * cplus-dem.c (remember_Btype): Don't call memcpy with LEN==0.
This is OK.