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: [PATCH] Fix overzealous folding


On Fri, May 16, 2008 at 8:34 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> I don't follow this.  If boolean is an enumeral type with {0, 1} then
>> (boolean)(x & 1) == ((boolean)x) & 1 as the cast to boolean is
>> truncating to {0, 1} as far as VRP is concerned (what is the precision of
>> boolean?).
>
> Given the range [1; +INF] for x, what's the range on each side of the == sign?
> (boolean has precision 8 in Ada).
>
>> Which is why I ask if this "truncation" semantics of VRP (if
>> it doesn't match the general truncating of precision changes) is a
>> problem - I'd rather remove this special case as from VRP as as a special
>> case there may be similar problems elsewhere.
>
> The 2 things are clearly not compatible, so one of them needs to be disabled.
> Since the folding is already disabled for BOOLEAN_TYPE, I think it makes sense
> to disable it for ENUMERAL_TYPE too.  If you think it's better to disable the
> VRP semantics, then let's disable it.

The problem seems to be caused by adjust_range_with_scev (after applying the
patch I posted).  If I remove that from VRP the test is retained.  Now - I don't
feel exactly like digging into this - is there a chance to minimize the testcase
or make a C one?  I suppose one of the TYPE_MIN/MAX_VALUE uses in
tree-ssa-loop-niter.c is the cause of the range still "leaking".

Richard.


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