This is the mail archive of the
mailing list for the GCC project.
Re: [gfortran] Updates to ISHFT translation
- From: Steven Bosscher <stevenb at suse dot de>
- To: fortran at gcc dot gnu dot org
- Cc: Tobias SchlÃter <tobias dot schlueter at physik dot uni-muenchen dot de>, patch <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 9 Jan 2005 17:55:32 +0100
- Subject: Re: [gfortran] Updates to ISHFT translation
- Organization: SUSE Labs
- References: <41E15E09.firstname.lastname@example.org>
On Sunday 09 January 2005 17:38, Tobias SchlÃter wrote:
> When investigating PR 19334, I noticed that there's a path where an
> unsigned variable would silently be converted into a signed one (i.e.
> "build (EXPR, signed_type, a, ...)" instead of "build (EXPR, signed_type,
> convert (signed_type, a), ...))"). This patch fixes this, and reformats a
> few lines in the function.
> Bubblestrapped and tested, ok?
> - Tobi
> 2005-01-09 Tobias Schlueter <email@example.com>
> * trans-intrinsic.c (gfc_conv_intrinsic_ishft): Fix signed / unsigned
> confusion, formatting changes.
> - /* Right shift if negative. */
> - rshift = convert (type, fold (build2 (RSHIFT_EXPR, utype, arg, width)));
> + /* Right shift if negative.
> + We convert to an unsigned type because we want a logical shift.
> + The standard doesn't define the case of shifting negative
> + numbers, and we try to be compatible with other compilers, most
> + notably g77, here. */
> + rshift = convert (type,
> + fold (build2 (RSHIFT_EXPR, utype,
> + convert (type, arg), width)));
Why convert there instead of fold_convert?