[gfortran] Updates to ISHFT translation
Steven Bosscher
stevenb@suse.de
Sun Jan 9 16:53:00 GMT 2005
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 <tobias.schlueter@physik.uni-muenchen.de>
>
> * 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?
Gr.
Steven
More information about the Fortran
mailing list