OSDN Git Service

* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: When
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 24 Oct 2009 11:12:21 +0000 (11:12 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 24 Oct 2009 11:12:21 +0000 (11:12 +0000)
processing the parent type, build the COMPONENT_REF for a discriminant
with the proper type.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153528 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/gcc-interface/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/specs/pack4.ads [new file with mode: 0644]

index 231de30..dae8d31 100644 (file)
@@ -1,5 +1,11 @@
 2009-10-24  Eric Botcazou  <ebotcazou@adacore.com>
 
+       * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: When
+       processing the parent type, build the COMPONENT_REF for a discriminant
+       with the proper type.
+
+2009-10-24  Eric Botcazou  <ebotcazou@adacore.com>
+
        * init.c (__gnat_adjust_context_for_raise): Mention _Unwind_GetIPInfo.
        * gcc-interface/Makefile.in (GNATLIBCFLAGS_FOR_C): Add HAVE_GETIPINFO.
        Pass GNATLIBCFLAGS_FOR_C to recursive invocations.
index d0b52f2..6abb366 100644 (file)
@@ -2729,15 +2729,16 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
                   Present (gnat_field);
                   gnat_field = Next_Stored_Discriminant (gnat_field))
                if (Present (Corresponding_Discriminant (gnat_field)))
-                 save_gnu_tree
-                   (gnat_field,
-                    build3 (COMPONENT_REF,
-                            get_unpadded_type (Etype (gnat_field)),
-                            gnu_get_parent,
-                            gnat_to_gnu_field_decl (Corresponding_Discriminant
-                                                    (gnat_field)),
-                            NULL_TREE),
-                    true);
+                 {
+                   tree gnu_field
+                     = gnat_to_gnu_field_decl (Corresponding_Discriminant
+                                               (gnat_field));
+                   save_gnu_tree
+                     (gnat_field,
+                      build3 (COMPONENT_REF, TREE_TYPE (gnu_field),
+                              gnu_get_parent, gnu_field, NULL_TREE),
+                      true);
+                 }
 
            /* Then we build the parent subtype.  If it has discriminants but
               the type itself has unknown discriminants, this means that it
index 73d8d6b..178af56 100644 (file)
@@ -1,5 +1,9 @@
 2009-10-24  Eric Botcazou  <ebotcazou@adacore.com>
 
+       * gnat.dg/specs/pack4.ads: New test.
+
+2009-10-24  Eric Botcazou  <ebotcazou@adacore.com>
+
        * gnat.dg/null_pointer_deref1.adb: New test.
        * gnat.dg/null_pointer_deref2.adb: Likewise.
 
diff --git a/gcc/testsuite/gnat.dg/specs/pack4.ads b/gcc/testsuite/gnat.dg/specs/pack4.ads
new file mode 100644 (file)
index 0000000..82b76d2
--- /dev/null
@@ -0,0 +1,12 @@
+package Pack4 is
+
+   type Buffer is array (Natural range <>) of Boolean;
+
+   type Root (Size : Natural) is tagged record
+      Data : Buffer (1..Size);
+   end record;
+   pragma Pack (Root);
+
+   type Derived is new Root with null record;
+
+end Pack4;