aboutsummaryrefslogtreecommitdiffstats
path: root/translate
diff options
context:
space:
mode:
Diffstat (limited to 'translate')
-rw-r--r--translate/grt/grt-stats.adb28
-rw-r--r--translate/translation.adb9
2 files changed, 27 insertions, 10 deletions
diff --git a/translate/grt/grt-stats.adb b/translate/grt/grt-stats.adb
index 4dd9ee6e2..065909b11 100644
--- a/translate/grt/grt-stats.adb
+++ b/translate/grt/grt-stats.adb
@@ -19,6 +19,7 @@ with System; use System;
with System.Storage_Elements; -- Work around GNAT bug.
with Grt.Stdio; use Grt.Stdio;
with Grt.Astdio; use Grt.Astdio;
+with Grt.Vstrings;
with Grt.Signals;
with Grt.Processes;
with Grt.Types; use Grt.Types;
@@ -70,20 +71,29 @@ package body Grt.Stats is
procedure Put (Stream : FILEs; Val : Clock_T)
is
- Fmt : constant String := "%3d.%03d" & Character'Val (0);
+ use Grt.Vstrings;
- procedure fprintf (Stream : FILEs; Fmt : Address; A, B : Clock_T);
- pragma Import (C, fprintf);
-
- Sec : Clock_T;
- Ms : Clock_T;
+ Ms : Ghdl_I32;
+ Buf : String (1 .. 11);
+ First : Natural;
+ C : Character;
begin
- Sec := Val / One_Second;
+ To_String (Buf, First, Ghdl_I32 (Val / One_Second));
+ if First > 8 then
+ Buf (8 .. First - 1) := (others => ' ');
+ First := 8;
+ end if;
+ Put (Stream, Buf (First .. Buf'Last));
+ Put (Stream, '.');
-- Avoid overflow.
- Ms := ((Val mod One_Second) * 1000) / One_Second;
+ Ms := Ghdl_I32 (((Val mod One_Second) * 1000) / One_Second);
- fprintf (Stream, Fmt'Address, Sec, Ms);
+ for I in 1 .. 3 loop
+ C := Character'Val (Character'Pos ('0') + (Ms / 100));
+ Put (Stream, C);
+ Ms := (Ms * 10) mod 1000;
+ end loop;
end Put;
procedure Put (Stream : FILEs; T : Time_Stats) is
diff --git a/translate/translation.adb b/translate/translation.adb
index a55314a4a..a0e63eef4 100644
--- a/translate/translation.adb
+++ b/translate/translation.adb
@@ -8787,10 +8787,12 @@ package body Translation is
-- Deferred constant are never considered as locally static.
-- FIXME: to be improved ?
- -- Only required for transient types.
+ -- open_temp/close_temp only required for transient types.
+ Open_Temp;
Define_Global_Const
(Info.Object_Var,
Chap7.Translate_Static_Expression (Val, Def));
+ Close_Temp;
end if;
when others =>
Error_Kind ("create_objet", El);
@@ -12052,6 +12054,11 @@ package body Translation is
end if;
-- No check for 'Range or 'Reverse_Range.
+ if Get_Kind (Expr_Type) not in Iir_Kinds_Discrete_Subtype_Definition
+ then
+ return True;
+ end if;
+
Rng := Get_Range_Constraint (Expr_Type);
if (Get_Kind (Rng) = Iir_Kind_Range_Array_Attribute
or Get_Kind (Rng) = Iir_Kind_Reverse_Range_Array_Attribute)