]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix infinite loop on MSP430 with -mlarge flag
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 11 Sep 2024 18:15:32 +0000 (20:15 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 8 Oct 2024 08:37:15 +0000 (10:37 +0200)
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.

gcc/ada/gcc-interface/decl.cc

index 880eaff8d0b6ea2aaaae2f792167cdc788e8b3f0..79d60c0c2213d4b708028546e188744c5225ec7b 100644 (file)
@@ -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.  */