This is the mail archive of the 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: [PATCH][RFC] Bit CCP and pointer alignment propagation

On 07/30/2010 03:39 PM, Richard Guenther wrote:
On Fri, 30 Jul 2010, Paolo Bonzini wrote:

On 07/30/2010 03:15 PM, Richard Guenther wrote:
I think we can have negative shift counts (at least the constant folding
code suggests so), this is why I have the code as-is.

No, that seems very weird. Sure expand does not handle it, and the implementation-defined section of the manual does not mention it. I'm more inclined to consider it a historical wart, given this comment:

   /* Previously detected shift-counts computed by NEGATE_EXPR
      and shifted in the other direction; but that does not work
      on all machines.  */

dating back to the beginning of the GCC repo.  I wonder what the attached
patch would do.

Maybe - at least with 2<< -1 we only warn:

t.c:3: warning: left shift count is negative

and happily continue, doing a constant right shift.

So the patch would crash. The right solution is probably to change the shift count to unsigned and fix the fallout.


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