https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90578

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #4 from anlauf at gcc dot gnu.org ---
(In reply to rguent...@suse.de from comment #3)
> On Thu, 23 May 2019, dominiq at lps dot ens.fr wrote:
> > I don't see any mention of "left-shift by negative value is undefined".
> 
> But it doesn't define what happens either ;)  Thus it is "undefined" :P
> 
> So, if the GNU extension would document it as "A LSHIFT by a 
> negative value is treated as a RSHIFT" then the frontend has
> to emit y < 0 ? x >> y : x << y since what I am saying is that
> the middle-end follows the C standard here and treats negative
> shift amounts as undefined.

The gfortran documentation of LSHIFT (and RSHIFT) mentions:

"This function has been superseded by the ISHFT intrinsic, which is standard in
Fortran 95 and later."

The natural solution would be to implement LSHIFT/RSHIFT in terms of ISHFT,
which does handle positive and negative shifts.

I might have a look at it.

Reply via email to