diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-01-26 17:04:05 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-01-26 17:04:05 +0100 |
commit | 060d785216fd7006482608473341354ade78f8b9 (patch) | |
tree | 3064907777d0844c918277d7cbe22aed38d96d35 /src/synth | |
parent | 2af18ead15c7b2f7837e821f06d1fa181bdbf5c4 (diff) | |
download | ghdl-060d785216fd7006482608473341354ade78f8b9.tar.gz ghdl-060d785216fd7006482608473341354ade78f8b9.tar.bz2 ghdl-060d785216fd7006482608473341354ade78f8b9.zip |
synth: avoid crash on incorrect slice direction. For #1116
Diffstat (limited to 'src/synth')
-rw-r--r-- | src/synth/netlists-builders.adb | 1 | ||||
-rw-r--r-- | src/synth/synth-expr.adb | 10 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/synth/netlists-builders.adb b/src/synth/netlists-builders.adb index c205ef318..c591c38a8 100644 --- a/src/synth/netlists-builders.adb +++ b/src/synth/netlists-builders.adb @@ -1343,7 +1343,6 @@ package body Netlists.Builders is is Wd : constant Width := Get_Width (I); pragma Assert (Wd /= No_Width); - pragma Assert (W > 0); pragma Assert (W + Off <= Wd); Inst : Instance; O : Net; diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb index 1b3e05df7..8e334cc2a 100644 --- a/src/synth/synth-expr.adb +++ b/src/synth/synth-expr.adb @@ -1323,6 +1323,11 @@ package body Synth.Expr is Error_Msg_Synth (+Name, "direction mismatch in slice"); Off := 0; Wd := 0; + if Dir = Iir_To then + Res_Bnd := (Dir => Iir_To, Left => 1, Right => 0, Len => 0); + else + Res_Bnd := (Dir => Iir_Downto, Left => 0, Right => 1, Len => 0); + end if; return; end if; @@ -1418,6 +1423,11 @@ package body Synth.Expr is Inp := No_Net; Off := 0; Wd := 0; + if Dir = Iir_To then + Res_Bnd := (Dir => Iir_To, Left => 1, Right => 0, Len => 0); + else + Res_Bnd := (Dir => Iir_Downto, Left => 0, Right => 1, Len => 0); + end if; return; end if; |