]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Strip conversions for the implementation of storage models
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 29 Nov 2022 11:29:30 +0000 (12:29 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 1 Dec 2022 13:53:54 +0000 (14:53 +0100)
This is necessary for unconstrained allocators with qualified expression.

gcc/ada/

* gcc-interface/trans.cc (get_storage_model_access): Strip any type
conversion around the node before looking into it.

gcc/ada/gcc-interface/trans.cc

index b9d7c015a73d58a192795e0e0048fbd3144e110f..a012271abf37e4f5b19582b4584a74ed503768ba 100644 (file)
@@ -4400,6 +4400,11 @@ get_storage_model_access (Node_Id gnat_node, Entity_Id *gnat_smo)
       return;
     }
 
+  /* Now strip any type conversion from GNAT_NODE.  */
+  if (Nkind (gnat_node) == N_Type_Conversion
+      || Nkind (gnat_node) == N_Unchecked_Type_Conversion)
+    gnat_node = Expression (gnat_node);
+
   while (node_is_component (gnat_node))
     gnat_node = Prefix (gnat_node);