diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-04-16 18:22:59 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-04-16 18:22:59 +0200 |
commit | 2be57cd4116a65646f929f169ea96ca8c449cc5d (patch) | |
tree | 86d421c296334bba76d54bd12598e27c8cb584dd | |
parent | 043c2a94133063d3fdbf6458e238ebafa3c57b35 (diff) | |
download | ghdl-2be57cd4116a65646f929f169ea96ca8c449cc5d.tar.gz ghdl-2be57cd4116a65646f929f169ea96ca8c449cc5d.tar.bz2 ghdl-2be57cd4116a65646f929f169ea96ca8c449cc5d.zip |
synth: check for matching bounds in subtype conversions.
-rw-r--r-- | src/synth/synth-expr.adb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb index a256cbe09..5125e2ee8 100644 --- a/src/synth/synth-expr.adb +++ b/src/synth/synth-expr.adb @@ -717,6 +717,9 @@ package body Synth.Expr is -- Propagate error. return No_Valtyp; end if; + if Dtype = Vtype then + return Vt; + end if; case Dtype.Kind is when Type_Bit => @@ -786,7 +789,14 @@ package body Synth.Expr is return Vt; when Type_Array => pragma Assert (Vtype.Kind = Type_Array); - -- TODO: check bounds, handle elements + -- Check bounds. + for I in Vtype.Abounds.D'Range loop + if Vtype.Abounds.D (I).Len /= Dtype.Abounds.D (I).Len then + Error_Msg_Synth (+Loc, "mismatching array bounds"); + return No_Valtyp; + end if; + end loop; + -- TODO: check element. if Bounds then return Reshape_Value (Vt, Dtype); else |