This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: [gfortran] Updates to ISHFT translation


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


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