This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Fix compiler crash on imported procedure

The compiler was failing to gimplify a locally defined unconstrained array 
type which is the designated type of an anonymous access type defined in the 
declaration of an imported procedure, which results in a crash in the DWARF 
debug back-end with -g.  Fixed by removing a couple of suspicuous lines added 
during the transition to Tree-SSA.

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

2009-04-21  Eric Botcazou  <>

	* gcc-interface/decl.c (gnat_to_gnu_entity): Do not set force_global
	for imported subprograms.

2009-04-21  Eric Botcazou  <>

	* gnat.dg/[sb]: New test.

Eric Botcazou
Index: gcc-interface/decl.c
--- gcc-interface/decl.c	(revision 146468)
+++ gcc-interface/decl.c	(working copy)
@@ -332,13 +332,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
      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.  */
-- { 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;
      Proc (Temp'Access);

end Import1;
package Import1 is

   type Arr is array (Positive range <>) of Integer;

   procedure Create (Bounds : Arr);

end Import1;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]