https://gcc.gnu.org/g:9fd38cc5d636124f0611aa5d26ac4258431f164a
commit r15-4166-g9fd38cc5d636124f0611aa5d26ac4258431f164a Author: Eric Botcazou <ebotca...@adacore.com> Date: Wed Sep 11 20:15:32 2024 +0200 ada: Fix infinite loop on MSP430 with -mlarge flag This removes the loop trying to find a pointer mode among the integer modes, which is obsolete and does not work on platforms where pointers have unusual size like MSP430 or special semantics like Morello. gcc/ada/ChangeLog: PR ada/116498 * gcc-interface/decl.cc (validate_size): Use the size of the default pointer mode as the minimum size for access types and fat pointers. Diff: --- gcc/ada/gcc-interface/decl.cc | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index 880eaff8d0b6..79d60c0c2213 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -9602,14 +9602,9 @@ validate_size (Uint uint_size, tree gnu_type, Entity_Id gnat_object, old_size = max_size (old_size, true); /* If this is an access type or a fat pointer, the minimum size is that given - by the smallest integral mode that's valid for pointers. */ + by the default pointer mode. */ if (TREE_CODE (gnu_type) == POINTER_TYPE || TYPE_IS_FAT_POINTER_P (gnu_type)) - { - scalar_int_mode p_mode = NARROWEST_INT_MODE; - while (!targetm.valid_pointer_mode (p_mode)) - p_mode = GET_MODE_WIDER_MODE (p_mode).require (); - old_size = bitsize_int (GET_MODE_BITSIZE (p_mode)); - } + old_size = bitsize_int (ptr_mode); /* Issue an error either if the default size of the object isn't a constant or if the new size is smaller than it. */