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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to amker from comment #6)
> Ok, in this case I need to check idx_step is negative if it's signed type;
> or idx_step has sign bit if it's unsigned type (negative step in effect). 
> tree_int_cst_sgn always returning 1 for (sizetype)-1 looks not working here?

tree_int_cst_compare (idx_step, size_zero_node) < 0 would be also always false
for unsigned types.  Perhaps you can use wi::neg_p (idx_step) then, that will
return true whenever idx_step in corresponding signed type (with the same
precision as idx_step's type) is negative.

But, is it right to consider those as negative steps?
I mean, say
for (unsigned long long c = 0; c < 0x8000000000000005ULL; c +=
0x8000000000000001ULL)
is actually positive step, not negative one.

Reply via email to