This is the mail archive of the gcc-patches@gcc.gnu.org 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 handling of No_Exception_Handlers in regular run-time


Tested on i686-linux, committed on trunk

This change fixes a bug in the handling of pragma No_Exception_Handlers
with a regular run-time, which would generate incorrect calls to
__gnat_last_chance_handler.

The following program should run generate:

raised PROGRAM_ERROR : no_exc.adb:6 explicit raise

pragma Restrictions (No_Exception_Handlers);
procedure no_exc is
begin
   raise Program_Error;
end;

Also, restriction No_Elaboration_Code should be enforced on a unit by unit
basis.
The use of inlining wrongly imported this restriction from a withed package
containing this restriction and a subprogram to be inlined. The following
example should compile cleanly when inlining (-gnatn) is enabled:

package P is
   function Something return Integer;
end P;

with Q;
package body P is

   Result : Integer;

   function Something return Integer is
   begin
      return Result;
   end Something;
begin
   Result := Q.Init;
end P;

	package Q is
   function Init return Integer;
   pragma Inline (Init);
end Q;

pragma Restrictions (No_Elaboration_Code);
package body Q is
   function Init return Integer is
   begin
      return 42;
   end Init;
end Q;

2007-06-06  Arnaud Charlet  <charlet@adacore.com>

	* restrict.ads, restrict.adb (No_Exception_Handlers_Set): Only return
	true if configurable run-time or No_Run_Time is set.
	(Set_Restriction): Avoid setting restriction No_Elaboration_Code when
	processing an unit which is not the one being compiled.

Attachment: difs
Description: Text document


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