This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix various undefined behaviors in gcc found by bootstrap-ubsan
- From: Mike Stump <mikestump at comcast dot net>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 2 Jul 2014 09:43:06 -0700
- Subject: Re: [PATCH] Fix various undefined behaviors in gcc found by bootstrap-ubsan
- Authentication-results: sourceware.org; auth=none
- References: <20140702081448 dot GW31640 at tucnak dot redhat dot com>
On Jul 2, 2014, at 1:14 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
wide-int part, Ok.
> * wide-int-print.cc (print_decs): Negate UHWI instead of HWI.
> --- gcc/wide-int-print.cc.jj 2014-05-11 22:21:04.000000000 +0200
> +++ gcc/wide-int-print.cc 2014-06-30 12:02:11.349485371 +0200
> @@ -62,7 +62,8 @@ print_decs (const wide_int_ref &wi, char
> || (wi.get_len () == 1))
> {
> if (wi::neg_p (wi))
> - sprintf (buf, "-" HOST_WIDE_INT_PRINT_UNSIGNED, -wi.to_shwi ());
> + sprintf (buf, "-" HOST_WIDE_INT_PRINT_UNSIGNED,
> + -(unsigned HOST_WIDE_INT) wi.to_shwi ());
> else
> sprintf (buf, HOST_WIDE_INT_PRINT_DEC, wi.to_shwi ());
> }