public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Fix ICE on instantiation of packed array element
@ 2017-05-15  9:40 Eric Botcazou
  0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2017-05-15  9:40 UTC (permalink / raw)
  To: gcc-patches

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

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


2017-05-15  Pierre-Marie de Rodat  <derodat@adacore.com>

	* gcc-interface/utils.c (can_materialize_object_renaming_p):
	Synchronize with GNAT's Exp_Dbug.Debug_Renaming_Declaration:
	process Original_Node instead of expanded names.


2017-05-15  Pierre-Marie de Rodat  <derodat@adacore.com>

	* gnat.dg/specs/pack13.ads: New test.

-- 
Eric Botcazou

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

Index: gcc-interface/utils.c
===================================================================
--- gcc-interface/utils.c	(revision 248051)
+++ gcc-interface/utils.c	(working copy)
@@ -5431,11 +5431,16 @@ can_materialize_object_renaming_p (Node_
 {
   while (true)
     {
+      expr = Original_Node (expr);
+
       switch Nkind (expr)
 	{
 	case N_Identifier:
 	case N_Expanded_Name:
-	  return true;
+	  if (!Present (Renamed_Object (Entity (expr))))
+	    return true;
+	  expr = Renamed_Object (Entity (expr));
+	  break;
 
 	case N_Selected_Component:
 	  {

[-- Attachment #3: pack13.ads --]
[-- Type: text/x-adasrc, Size: 403 bytes --]

-- { dg-do compile }

package Pack13 is

  generic
    type Value_Type is private;
    Value : in out Value_Type;
  package G is end G;

  type Rec is record
    B : Boolean;
  end record;
  for Rec use record
    B at 0 range 8 .. 8;
  end record;
  for Rec'size use 9;

  type Arr is array (Boolean) of Rec;
  pragma Pack (Arr);

  A : Arr;

  package My_G is new G (Boolean, A(True).B);

end Pack13;

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

only message in thread, other threads:[~2017-05-15  8:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-15  9:40 [Ada] Fix ICE on instantiation of packed array element 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).