OSDN Git Service

* gcc-interface/decl.c (gnat_to_gnu_entity): Do not set force_global
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 21 Apr 2009 07:27:26 +0000 (07:27 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 21 Apr 2009 07:27:26 +0000 (07:27 +0000)
for imported subprograms.

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

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

index d771e98..3b93881 100644 (file)
@@ -1,5 +1,10 @@
 2009-04-21  Eric Botcazou  <ebotcazou@adacore.com>
 
+       * gcc-interface/decl.c (gnat_to_gnu_entity): Do not set force_global
+       for imported subprograms.
+
+2009-04-21  Eric Botcazou  <ebotcazou@adacore.com>
+
        * gcc-interface/decl.c (gnat_to_gnu_entity) <object>: Do not make
        constant objects covered by 13.3(19) volatile.
 
index 18ebeff..898af24 100644 (file)
@@ -332,13 +332,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
      another compilation unit) public entities, show we are at global level
      for the purpose of computing scopes.  Don't do this for components or
      discriminants since the relevant test is whether or not the record is
-     being defined.  But do this for Imported functions or procedures in
-     all cases.  */
-  if ((!definition && Is_Public (gnat_entity)
-       && !Is_Statically_Allocated (gnat_entity)
-       && kind != E_Discriminant && kind != E_Component)
-      || (Is_Imported (gnat_entity)
-         && (kind == E_Function || kind == E_Procedure)))
+     being defined.  */
+  if (!definition
+      && Is_Public (gnat_entity)
+      && !Is_Statically_Allocated (gnat_entity)
+      && kind != E_Component
+      && kind != E_Discriminant)
     force_global++, this_global = true;
 
   /* Handle any attributes directly attached to the entity.  */
index 5b16c6a..a81f64a 100644 (file)
@@ -1,6 +1,11 @@
+2009-04-21  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/import1.ad[sb]: New test.
+
 2009-04-20  Andrew Pinski  <andrew_pinski@playstation.sony.com>
 
-       * objc/execute/exceptions/handler-1.m: For the NeXT runtime, just return 0.
+       * objc/execute/exceptions/handler-1.m: For the NeXT runtime, just
+       return 0.
 
 2009-04-20  Tobias Burnus  <burnus@net-b.de>
 
diff --git a/gcc/testsuite/gnat.dg/import1.adb b/gcc/testsuite/gnat.dg/import1.adb
new file mode 100644 (file)
index 0000000..4e40560
--- /dev/null
@@ -0,0 +1,17 @@
+-- { dg-do compile }\r
+-- { dg-options "-g" }\r
+\r
+package body Import1 is\r
+\r
+   procedure Create (Bounds : Arr) is\r
+      type Bound_Array is array (Bounds'Range) of Integer;\r
+\r
+      procedure Proc (Ptr : access Bound_Array);\r
+      pragma Import (C, Proc);\r
+\r
+      Temp : aliased Bound_Array;\r
+   begin\r
+      Proc (Temp'Access);\r
+   end;\r
+\r
+end Import1;\r
diff --git a/gcc/testsuite/gnat.dg/import1.ads b/gcc/testsuite/gnat.dg/import1.ads
new file mode 100644 (file)
index 0000000..cb00a0c
--- /dev/null
@@ -0,0 +1,7 @@
+package Import1 is\r
+\r
+   type Arr is array (Positive range <>) of Integer;\r
+\r
+   procedure Create (Bounds : Arr);\r
+\r
+end Import1;\r