public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Fix annoying oversight in elaboration of subprograms
@ 2016-06-13  8:18 Eric Botcazou
  0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2016-06-13  8:18 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

This fixes an annoying oversight introduced in the new elaboration model for 
subprograms in gigi: calls might be generated while the type of parameters is 
still incomplete, which leads to truncation to the low part for access types
on 64-bit targets...

Tested on x86_64-suse-linux, applied on the mainline.


2016-06-13  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/decl.c (gnat_to_gnu_subprog_type): Build only minimal
	PARM_DECL when the parameter type is dummy.
	* gcc-interface/trans.c (Call_to_gnu): Translate formal types before
	formal objects.

-- 
Eric Botcazou

[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 1401 bytes --]

Index: gcc-interface/decl.c
===================================================================
--- gcc-interface/decl.c	(revision 237360)
+++ gcc-interface/decl.c	(working copy)
@@ -5959,8 +5959,11 @@ gnat_to_gnu_subprog_type (Entity_Id gnat
 
 	      else
 		{
+		  /* Build a minimal PARM_DECL without DECL_ARG_TYPE so that
+		     Call_to_gnu will stop if it encounters the PARM_DECL.  */
 		  gnu_param
-		    = create_param_decl (gnu_param_name, gnu_param_type);
+		    = build_decl (input_location, PARM_DECL, gnu_param_name,
+				  gnu_param_type);
 		  associate_subprog_with_dummy_type (gnat_subprog,
 						     gnu_param_type);
 		  incomplete_profile_p = true;
Index: gcc-interface/trans.c
===================================================================
--- gcc-interface/trans.c	(revision 237328)
+++ gcc-interface/trans.c	(working copy)
@@ -4341,9 +4341,9 @@ Call_to_gnu (Node_Id gnat_node, tree *gn
        gnat_actual = Next_Actual (gnat_actual))
     {
       Entity_Id gnat_formal_type = Etype (gnat_formal);
+      tree gnu_formal_type = gnat_to_gnu_type (gnat_formal_type);
       tree gnu_formal = present_gnu_tree (gnat_formal)
 			? get_gnu_tree (gnat_formal) : NULL_TREE;
-      tree gnu_formal_type = gnat_to_gnu_type (gnat_formal_type);
       const bool is_true_formal_parm
 	= gnu_formal && TREE_CODE (gnu_formal) == PARM_DECL;
       const bool is_by_ref_formal_parm

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

only message in thread, other threads:[~2016-06-13  8:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-13  8:18 [Ada] Fix annoying oversight in elaboration of subprograms Eric Botcazou

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).