https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33994
--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Eric Botcazou <[email protected]>: https://gcc.gnu.org/g:04794bba3a6b1ec68947725d973f8fb3f7ea5364 commit r16-5539-g04794bba3a6b1ec68947725d973f8fb3f7ea5364 Author: Eric Botcazou <[email protected]> Date: Mon Nov 24 10:36:35 2025 +0100 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.
