From: Eric Botcazou <ebotca...@adacore.com>

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.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 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 880eaff8d0b..79d60c0c221 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.  */
-- 
2.43.0

Reply via email to