Fix wrong code for indexed component with very large index type
This fixes an old issue whereby we generate wrong code in Ada for an indexed
component in an array with a ludicrously large index type instead of raising
Storage_Error. We would need the counterpart of int_const_binop for unop in
the general case, but that's not worth the hassle and int_const_convert is
good enough.
gcc/
PR ada/33994
* fold-const.h (int_const_convert): New prototype.
* fold-const.cc (fold_convert_const_int_from_int): Rename to...
(int_const_convert): ...this, remove static keyword and add third
parameter OVERFLOWABLE.
(fold_convert_const): Call int_const_convert if ARG1 is an integer
constant.
gcc/ada/
PR ada/33994
* gcc-interface/utils.cc (convert) <INTEGER_TYPE>: Call
int_const_convert if the expression is an integer constant.
gcc/testsuite/
* gnat.dg/object_overflow6.adb: New test.