[Bug tree-optimization/31178] VRP can infer a range for b in a >> b and a << b

amacleod at redhat dot com gcc-bugzilla@gcc.gnu.org
Tue Mar 22 14:21:22 GMT 2022


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

Andrew Macleod <amacleod at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amacleod at redhat dot com

--- Comment #8 from Andrew Macleod <amacleod at redhat dot com> ---
Is this always true?

I implemented this for GCC13 in the new side-effect code, and its causing
problems in fortran.

In particular  gfortran.dg/check_bits_1.f90 goes into an infinite loop. I am
seeing things like

nb = bit_size (i)
do shift = 0, nb
     k = shiftl (i, shift) ! Fortran 2008
     i = shiftr (k, shift)

So it appears to do shifts on [0, 32] rather than [0, 31], and when I go look
for fortran 2008 info, i find:

"Its value must be non-negative, and less than or equal to BIT_SIZE(I)"

so it seem [0, N] for fortran rather than [0, N)?   Are there other language
issues as well?


More information about the Gcc-bugs mailing list