[patch] for PRs 27639 and 26719

Daniel Berlin dberlin@dberlin.org
Fri May 26 19:06:00 GMT 2006


Zdenek Dvorak wrote:
> Hello,
> 
>>> The other smaller changes are:
>>> -- the mostly unrelated code to determine whether chrec is growing or
>>>    decreasing was split from scev_probably_wraps_p to a separate function
>>> -- the code testing for used_in_pointer_arithmetic_p in
>>>    scev_probably_wraps_p was removed; the reason is that it
>>>    unfortunately this code is not correct -- even if we assume that the
>>>    arithmetics used in the statements for the
>>>    used_in_pointer_arithmetic_p is true does not wrap (which is a bit
>>>    doubtful, because these statements do not necessarily have to come
>>>    from the expansion of pointer arithmetics),it still does not say
>>>    anything about the operands of these statements (that may be wrapping
>>>    induction variables). 
>> You say it is incorrect without real details.
>> The code (which i believe seb wrote) was built to answer questions about
>> variables, not statements.
>> Looking at it, it checks whether every use of a variable is either
>> casted to a pointer, or an operand to a statement whose lhs is a pointer.
>>
>> IIRC, the basic pattern it was trying to match occurred *everywhere* we
>> had non-global array references, indexing into passed in
>> arrays/pointers, or pointer arithmetic.
>>
>> I.E.
>> foo[i][j] would generate something like:
>>
>>
>> idxtemp = i * 50;
>> idxtemp2 = j + idxtemp;
>> idxtemp3 = (int) foo;  (or was it &foo)
>> idxtemp4 = idxtemp3 + idxtemp2;
>> pointer = (int *)idxtemp4;
> but this might be considered too intrusive for stage 3;
> perhaps we can come up with some special-case handling for the meantime.
> 
> Zdenek
> 


BTW, do you have any more details on why you think it's broken?
Variables casted to a pointer or an operand to a statement whose lhs is
a pointer, shouldn't wrap.



More information about the Gcc-patches mailing list