summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-21 07:27:26 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-21 07:27:26 +0000
commitee162cd7be5d231a3e164f552ed72ceff939a027 (patch)
tree55f9187c0b6f69afbb0bd905dfd069a6e794ec8a
parentaac684f2c78efe82304307b46f784da84d76cded (diff)
downloadppe42-gcc-ee162cd7be5d231a3e164f552ed72ceff939a027.tar.gz
ppe42-gcc-ee162cd7be5d231a3e164f552ed72ceff939a027.zip
* gcc-interface/decl.c (gnat_to_gnu_entity): Do not set force_global
for imported subprograms. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146469 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/gcc-interface/decl.c13
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gnat.dg/import1.adb17
-rw-r--r--gcc/testsuite/gnat.dg/import1.ads7
5 files changed, 41 insertions, 8 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index d771e988a3e..3b93881a9a0 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -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.
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 18ebeff76ab..898af248a33 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -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. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5b16c6a8267..a81f64a5cd7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..4e4056098b5
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/import1.adb
@@ -0,0 +1,17 @@
+-- { dg-do compile }
+-- { dg-options "-g" }
+
+package body Import1 is
+
+ procedure Create (Bounds : Arr) is
+ type Bound_Array is array (Bounds'Range) of Integer;
+
+ procedure Proc (Ptr : access Bound_Array);
+ pragma Import (C, Proc);
+
+ Temp : aliased Bound_Array;
+ begin
+ Proc (Temp'Access);
+ end;
+
+end Import1;
diff --git a/gcc/testsuite/gnat.dg/import1.ads b/gcc/testsuite/gnat.dg/import1.ads
new file mode 100644
index 00000000000..cb00a0caf40
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/import1.ads
@@ -0,0 +1,7 @@
+package Import1 is
+
+ type Arr is array (Positive range <>) of Integer;
+
+ procedure Create (Bounds : Arr);
+
+end Import1;
OpenPOWER on IntegriCloud