Commit 488f9623 by Robert Dewar Committed by Arnaud Charlet

exp_ch6.adb (Expand_N_Subprogram_Body): Avoid trying to unnest generic subprograms.

2015-03-04  Robert Dewar  <dewar@adacore.com>

	* exp_ch6.adb (Expand_N_Subprogram_Body): Avoid trying to unnest
	generic subprograms.
	* exp_unst.adb (Check_Dynamic_Type): Handle record types properly
	(Note_Uplevel_Reference): Ignore uplevel references to non-types
	(Get_Level): Consider only subprograms, not blocks.
	(Visit_Node): Set proper condition for generating ARECnF entity.
	Ignore indirect calls. Ignore calls to subprograms
	outside our nest.
	(Unnest_Subprogram): Minor changes in dealing with ARECnF entity.
	(Add_Form_To_Spec): Properly set Last_Entity field.
	(Unnest_Subprogram): Set current subprogram scope for analyze calls.
	Handle case of no uplevel refs in outer subprogram
	Don't mark uplevel entities as aliased.
	Don't deal with calls with no ARECnF requirement.

2015-03-04  Robert Dewar  <dewar@adacore.com>

	* s-valrea.adb (Scan_Real): Remove redundant tests from scaling loops.
	* s-imgdec.adb (Set_Decimal_Digits): Remove redundant Max
	operation in computing LZ.
	* sem_attr.adb: Minor typo fix

From-SVN: r221177
parent b6a56408
2015-03-04 Robert Dewar <dewar@adacore.com>
* exp_ch6.adb (Expand_N_Subprogram_Body): Avoid trying to unnest
generic subprograms.
* exp_unst.adb (Check_Dynamic_Type): Handle record types properly
(Note_Uplevel_Reference): Ignore uplevel references to non-types
(Get_Level): Consider only subprograms, not blocks.
(Visit_Node): Set proper condition for generating ARECnF entity.
Ignore indirect calls. Ignore calls to subprograms
outside our nest.
(Unnest_Subprogram): Minor changes in dealing with ARECnF entity.
(Add_Form_To_Spec): Properly set Last_Entity field.
(Unnest_Subprogram): Set current subprogram scope for analyze calls.
Handle case of no uplevel refs in outer subprogram
Don't mark uplevel entities as aliased.
Don't deal with calls with no ARECnF requirement.
2015-03-04 Robert Dewar <dewar@adacore.com>
* s-valrea.adb (Scan_Real): Remove redundant tests from scaling loops.
* s-imgdec.adb (Set_Decimal_Digits): Remove redundant Max
operation in computing LZ.
* sem_attr.adb: Minor typo fix
2015-03-04 Robert Dewar <dewar@adacore.com>
* exp_ch7.adb: Minor reformatting.
* exp_unst.adb (Build_Tables): Fix minor glitch for no separate
spec case.
......
......@@ -5345,7 +5345,19 @@ package body Exp_Ch6 is
-- with nested subprograms, do the unnesting operation now.
if Opt.Unnest_Subprogram_Mode
and then Is_Library_Level_Entity (Spec_Id)
-- We are only interested in subprograms (not generic subprograms)
and then Is_Subprogram (Spec_Id)
-- Only deal with outer level subprograms. Nested subprograms are
-- handled as part of dealing with the outer level subprogram in
-- which they are nested.
and then Enclosing_Subprogram (Spec_Id) = Empty
-- We are only interested in subprograms that have nested subprograms
and then Has_Nested_Subprogram (Spec_Id)
then
Unnest_Subprogram (Spec_Id, N);
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -319,9 +319,11 @@ package body System.Img_Dec is
DA : Natural := Digits_After_Point;
-- Digits remaining to output after point
LZ : constant Integer :=
Integer'Max (0, Integer'Min (DA, -Digits_Before_Point));
-- Number of leading zeroes after point
LZ : constant Integer := Integer'Min (DA, -Digits_Before_Point);
-- Number of leading zeroes after point. Note: there used to be
-- a Max of this result with zero, but that's redundant, since
-- we know DA is positive, and because of the test above, we
-- know that -Digits_Before_Point >= 0.
begin
Set_Zeroes (LZ);
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
-- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -347,9 +347,10 @@ package body System.Val_Real is
Scale := Scale - Maxpow;
end loop;
if Scale > 0 then
Uval := Uval * Powten (Scale);
end if;
-- Note that we still know that Scale > 0, since the loop
-- above leaves Scale in the range 1 .. Maxpow.
Uval := Uval * Powten (Scale);
elsif Scale < 0 then
while (-Scale) > Maxpow loop
......@@ -357,9 +358,10 @@ package body System.Val_Real is
Scale := Scale + Maxpow;
end loop;
if Scale < 0 then
Uval := Uval / Powten (-Scale);
end if;
-- Note that we still know that Scale < 0, since the loop
-- above leaves Scale in the range -Maxpow .. -1.
Uval := Uval / Powten (-Scale);
end if;
-- Here is where we check for a bad based number
......
......@@ -247,7 +247,7 @@ package body Sem_Attr is
-- Common processing for attributes 'Old and 'Result. The routine checks
-- that the attribute appears in a postcondition-like aspect or pragma
-- associated with a suitable subprogram or a body. Flag Legal is set
-- when the above criterias are met. Spec_Id denotes the entity of the
-- when the above criteria are met. Spec_Id denotes the entity of the
-- subprogram [body] or Empty if the attribute is illegal.
procedure Bad_Attribute_For_Predicate;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment