https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62630
--- Comment #16 from Mircea Namolaru <mircea.namolaru at inria dot fr> ---
Yes, but it seems to me that the cast (not in the original code) should not
be generated at all if it could not be guaranteed that the casted-to type is
larger
enough to accommodate it. Otherwise you introduce a cast from a longer signed
type
to a shorter signed one whose behaviour is undefined by the C standard and was
not
in the original code.
So the cast in the following code is problematic (when
graphite_IV, a signed long is not in the range of a signed int).
_56 = (intD.6) graphite_IV.5_53;
_55 = aD.1830[_56];
The solution to fix this is to made Graphite not to generate
casts like this. An alternative is to infer the range of
graphite_IV like you do and remove the cast (but this seems more complicated
and risky as the analysis may not succeed and the problematic cast is not
removed).