OSDN Git Service

* gcc-interface/decl.c (gnat_to_gnu_entity): Fix formatting.
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 31 Jul 2008 22:04:03 +0000 (22:04 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 31 Jul 2008 22:04:03 +0000 (22:04 +0000)
* gcc-interface/utils.c (create_field_decl): Avoid superfluous work.

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

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

index f563595..fdb714c 100644 (file)
@@ -1,3 +1,8 @@
+2008-07-31  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc-interface/decl.c (gnat_to_gnu_entity): Fix formatting.
+       * gcc-interface/utils.c (create_field_decl): Avoid superfluous work.
+
 2008-07-31  Pascal Obry  <obry@adacore.com>
 
        * prj-nmsc.adb: Keep Object and Exec directory casing.
index b02b9a0..f8ebf5a 100644 (file)
@@ -3062,7 +3062,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
 
                        /* Discard old fields that are outside the new type.
                           This avoids confusing code scanning it to decide
-                          how to pass it to functions on some platforms.   */
+                          how to pass it to functions on some platforms.  */
                        if (TREE_CODE (gnu_new_pos) == INTEGER_CST
                            && TREE_CODE (TYPE_SIZE (gnu_type)) == INTEGER_CST
                            && !integer_zerop (gnu_size)
index 61e36fe..2105abd 100644 (file)
@@ -1755,7 +1755,7 @@ create_field_decl (tree field_name, tree field_type, tree record_type,
      of a copy.  This is the case for true bitfields, but the DECL_BIT_FIELD
      value we have at this point is not accurate enough, so we don't account
      for this here and let finish_record_type decide.  */
-  if (!type_for_nonaliased_component_p (field_type))
+  if (!addressable && !type_for_nonaliased_component_p (field_type))
     addressable = 1;
 
   DECL_NONADDRESSABLE_P (field_decl) = !addressable;
index feca055..6e460bc 100644 (file)
@@ -1,3 +1,7 @@
+2008-07-31  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/discr10.ad[sb]: New test.
+
 2008-07-31  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/35100
diff --git a/gcc/testsuite/gnat.dg/discr10.adb b/gcc/testsuite/gnat.dg/discr10.adb
new file mode 100644 (file)
index 0000000..4ad834f
--- /dev/null
@@ -0,0 +1,8 @@
+package body Discr10 is
+
+   function Get (X : R) return R is
+   begin
+     return R'(D1 => False, D2 => False, D3 => X.D3);
+   end;
+
+end Discr10;
diff --git a/gcc/testsuite/gnat.dg/discr10.ads b/gcc/testsuite/gnat.dg/discr10.ads
new file mode 100644 (file)
index 0000000..8df7ef1
--- /dev/null
@@ -0,0 +1,23 @@
+package Discr10 is
+
+   subtype Index is Natural range 0 .. 150;
+
+   type List is array (Index range <>) of Integer;
+
+   type R (D1 : Boolean := True; D2 : Boolean := False; D3 : Index := 0) is
+   record
+      case D2 is
+         when True =>
+            L : List (1 .. D3);
+            case D1 is
+               when True => I : Integer;
+               when False => null;
+            end case;
+         when False =>
+            null;
+      end case;
+   end record;
+
+   function Get (X : R) return R;
+
+end Discr10;