This fixes an hole in the declaration of __gnat_reraise_zcx, so that
the attached program now compiles without warnings.

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


2012-05-06  Tristan Gingold  <ging...@adacore.com>

        * gcc-interface/trans.c (gigi): Decorate reraise_zcx_decl.


2012-05-06  Tristan Gingold  <ging...@adacore.com>

        * gnat.dg/warn7.adb: New test.


-- 
Eric Botcazou
-- { dg-do compile }

procedure Warn7 is

   procedure Nested;
   pragma No_Return (Nested);

   procedure Nested is
   begin
      raise Constraint_Error;
   exception
      when Constraint_Error =>
         raise;
   end;

begin
   Nested;
end;
Index: gcc-interface/trans.c
===================================================================
--- gcc-interface/trans.c	(revision 187208)
+++ gcc-interface/trans.c	(working copy)
@@ -502,7 +502,12 @@ gigi (Node_Id gnat_root, int max_gnat_no
     = create_subprog_decl (get_identifier ("__gnat_reraise_zcx"), NULL_TREE,
 			   ftype, NULL_TREE, false, true, true, true, NULL,
 			   Empty);
+  /* Indicate that these never return.  */
   DECL_IGNORED_P (reraise_zcx_decl) = 1;
+  TREE_THIS_VOLATILE (reraise_zcx_decl) = 1;
+  TREE_SIDE_EFFECTS (reraise_zcx_decl) = 1;
+  TREE_TYPE (reraise_zcx_decl)
+    = build_qualified_type (TREE_TYPE (reraise_zcx_decl), TYPE_QUAL_VOLATILE);
 
   /* If in no exception handlers mode, all raise statements are redirected to
      __gnat_last_chance_handler.  No need to redefine raise_nodefer_decl since
@@ -550,6 +555,7 @@ gigi (Node_Id gnat_root, int max_gnat_no
        build_function_type_list (build_pointer_type (except_type_node),
 				 NULL_TREE),
      NULL_TREE, false, true, true, true, NULL, Empty);
+  DECL_IGNORED_P (get_excptr_decl) = 1;
 
   raise_nodefer_decl
     = create_subprog_decl

Reply via email to