aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2014-06-21 02:53:44 +0200
committerTristan Gingold <tgingold@free.fr>2014-06-21 02:53:44 +0200
commit5ca17f7e5385385c5094338c4fe368136d6fd336 (patch)
treead2162382067ba097f745a820a20948683c466ad
parentf8429fbe0d7e8f172fba2e3f3d157fbb6508da17 (diff)
downloadghdl-5ca17f7e5385385c5094338c4fe368136d6fd336.tar.gz
ghdl-5ca17f7e5385385c5094338c4fe368136d6fd336.tar.bz2
ghdl-5ca17f7e5385385c5094338c4fe368136d6fd336.zip
Fix regression for 'value on physical types.
-rw-r--r--translate/grt/grt-values.adb14
1 files changed, 9 insertions, 5 deletions
diff --git a/translate/grt/grt-values.adb b/translate/grt/grt-values.adb
index 7225dcee3..2715d5141 100644
--- a/translate/grt/grt-values.adb
+++ b/translate/grt/grt-values.adb
@@ -69,9 +69,9 @@ package body Grt.Values is
end if;
end To_LC;
- -- Return TRUE iff user string S (POS .. LEN) is equal to REF. Comparaison
- -- is case insensitive, but REF must be lowercase (REF is supposed to
- -- come from an RTI).
+ -- Return TRUE iff user string S (POS .. LEN - 1) is equal to REF.
+ -- Comparaison is case insensitive, but REF must be lowercase (REF is
+ -- supposed to come from an RTI).
function String_Match (S : Std_String_Basep;
Pos : Ghdl_Index_Type;
Len : Ghdl_Index_Type;
@@ -564,7 +564,7 @@ package body Grt.Values is
return Ghdl_I64
is
S : constant Std_String_Basep := Str.Base;
- Len : constant Ghdl_Index_Type := Str.Bounds.Dim_1.Length;
+ Len : Ghdl_Index_Type := Str.Bounds.Dim_1.Length;
Unit_Pos : Ghdl_Index_Type;
Lit_Pos : Ghdl_Index_Type;
Lit_End : Ghdl_Index_Type;
@@ -577,6 +577,10 @@ package body Grt.Values is
Multiple : Ghdl_Rti_Access;
Mult : Ghdl_I64;
begin
+ -- Remove trailing whitespaces. FIXME: also called in physical_split.
+ Lit_Pos := 0;
+ Remove_Whitespaces (S, Len, Lit_Pos);
+
-- Extract literal and unit
Ghdl_Value_Physical_Split (Str, Found_Real, Lit_Pos, Lit_End, Unit_Pos);
@@ -592,7 +596,7 @@ package body Grt.Values is
end loop;
if Multiple = null then
Error_C ("'value: unit '");
- Error_C_Std (S (Unit_Pos .. Len));
+ Error_C_Std (S (Unit_Pos .. Len - 1));
Error_C ("' not in physical type '");
Error_C (Phys_Rti.Name);
Error_E ("'");