public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-1394] ada: Add missing guards for degenerate storage models
@ 2023-05-30  7:19 Marc Poulhi?s
  0 siblings, 0 replies; only message in thread
From: Marc Poulhi?s @ 2023-05-30  7:19 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:8868ed495ffac3cdbe067bbc43be4c4f968581a9

commit r14-1394-g8868ed495ffac3cdbe067bbc43be4c4f968581a9
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Fri Apr 7 15:51:16 2023 +0200

    ada: Add missing guards for degenerate storage models
    
    gcc/ada/
    
            * gcc-interface/trans.cc (Attribute_to_gnu) <Attr_Size>: Check that
            the storage model has Copy_From before instantiating loads for it.
            <Attr_Length>: Likewise.
            <Attr_Bit_Position>: Likewise.
            (gnat_to_gnu) <N_Indexed_Component>: Likewise.
            <N_Slice>: Likewise.

Diff:
---
 gcc/ada/gcc-interface/trans.cc | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc
index 57933ceb8a3..18f7e73d45d 100644
--- a/gcc/ada/gcc-interface/trans.cc
+++ b/gcc/ada/gcc-interface/trans.cc
@@ -1978,7 +1978,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
       if (TREE_CODE (gnu_prefix) != TYPE_DECL)
 	{
 	  gnu_result = SUBSTITUTE_PLACEHOLDER_IN_EXPR (gnu_result, gnu_prefix);
-	  if (Present (gnat_smo))
+	  if (Present (gnat_smo)
+	      && Present (Storage_Model_Copy_From (gnat_smo)))
 	    gnu_result = INSTANTIATE_LOAD_IN_EXPR (gnu_result, gnat_smo);
 	}
       else if (CONTAINS_PLACEHOLDER_P (gnu_result))
@@ -2211,7 +2212,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
 	   handling.  Note that these attributes could not have been used on
 	   an unconstrained array type.  */
 	gnu_result = SUBSTITUTE_PLACEHOLDER_IN_EXPR (gnu_result, gnu_prefix);
-	if (Present (gnat_smo))
+	if (Present (gnat_smo)
+	    && Present (Storage_Model_Copy_From (gnat_smo)))
 	  gnu_result = INSTANTIATE_LOAD_IN_EXPR (gnu_result, gnat_smo);
 
 	/* Cache the expression we have just computed.  Since we want to do it
@@ -2373,7 +2375,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
 	/* If this has a PLACEHOLDER_EXPR, qualify it by the object we are
 	   handling.  */
 	gnu_result = SUBSTITUTE_PLACEHOLDER_IN_EXPR (gnu_result, gnu_prefix);
-	if (Present (gnat_smo))
+	if (Present (gnat_smo)
+	    && Present (Storage_Model_Copy_From (gnat_smo)))
 	  gnu_result = INSTANTIATE_LOAD_IN_EXPR (gnu_result, gnat_smo);
 	break;
       }
@@ -6701,7 +6704,8 @@ gnat_to_gnu (Node_Id gnat_node)
 	    gnu_result
 	      = build_binary_op (ARRAY_REF, NULL_TREE, gnu_result, gnu_expr);
 
-	    if (Present (gnat_smo))
+	    if (Present (gnat_smo)
+	        && Present (Storage_Model_Copy_From (gnat_smo)))
 	      instantiate_load_in_array_ref (gnu_result, gnat_smo);
 	  }
 
@@ -6746,7 +6750,8 @@ gnat_to_gnu (Node_Id gnat_node)
 	gnu_result = build_binary_op (ARRAY_RANGE_REF, gnu_result_type,
 				      gnu_array_object, gnu_expr);
 
-	if (Present (gnat_smo))
+	if (Present (gnat_smo)
+	    && Present (Storage_Model_Copy_From (gnat_smo)))
 	  instantiate_load_in_array_ref (gnu_result, gnat_smo);
 
 	/* If storage model access is required on the RHS, build the load.  */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-30  7:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-30  7:19 [gcc r14-1394] ada: Add missing guards for degenerate storage models Marc Poulhi?s

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).