This is the mail archive of the gcc@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: help for arm avr bfin cris frv h8300 m68k mcore mmix pdp11 rs6000 sh vax


On Fri, 13 Mar 2009, Richard Guenther wrote:

> Last time I sent a patch to remove the SHIFT_COUNT_TRUNCATED check
> from fold-const.c the reason that this was rejected was that we want to
> be consistend with target behavior...

I would disagree with such a rejection.  If we want to provide any sort of 
consistency I think it should be optional (an option like -fwrapv) and 
define the semantics at the language level rather than depending on the 
target.

> > As I understand it, SHIFT_COUNT_TRUNCATED is about the semantics of RTL,
> > and has no bearing on the implemented semantics of any source language or
> > of GENERIC or GIMPLE; GENERIC and GIMPLE both follow the rule that
> > out-of-range shifts (or rotates?), including those by negative amounts,
> > are undefined.
> 
> "Undefined" is a bad semantic for GIMPLE.  If the frontends want the middle-end
> to take advantage of undefinedness it needs to translate it to a useful defined
> state.

By undefined I mean that the middle-end may assume that the value is 
within range [0, number of value and sign bits in type) and transform on 
the basis of that assumption (including value range propagation).

-- 
Joseph S. Myers
joseph@codesourcery.com


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