aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/netlists-cleanup.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-01-11 07:43:03 +0100
committerTristan Gingold <tgingold@free.fr>2020-01-11 07:43:03 +0100
commitc2f7e242b048ae2691681d62b099ecf9634d6407 (patch)
treee5167810533a59dae77d845065e2aefa20136d15 /src/synth/netlists-cleanup.adb
parent39e7b128b765278f6b0197d5804afc8f43fb179f (diff)
downloadghdl-c2f7e242b048ae2691681d62b099ecf9634d6407.tar.gz
ghdl-c2f7e242b048ae2691681d62b099ecf9634d6407.tar.bz2
ghdl-c2f7e242b048ae2691681d62b099ecf9634d6407.zip
synth-cleanup: avoid a crash on undriven output. Fix #1078
Diffstat (limited to 'src/synth/netlists-cleanup.adb')
-rw-r--r--src/synth/netlists-cleanup.adb8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/synth/netlists-cleanup.adb b/src/synth/netlists-cleanup.adb
index 4d2cc40a9..f7342add9 100644
--- a/src/synth/netlists-cleanup.adb
+++ b/src/synth/netlists-cleanup.adb
@@ -129,9 +129,11 @@ package body Netlists.Cleanup is
if Get_Id (Inst) = Id_Output then
Inp := Get_Input (Inst, 0);
O := Get_Driver (Inp);
- Disconnect (Inp);
-
- Redirect_Inputs (Get_Output (Inst, 0), O);
+ if O /= No_Net then
+ -- Only when the output is driven.
+ Disconnect (Inp);
+ Redirect_Inputs (Get_Output (Inst, 0), O);
+ end if;
Remove_Instance (Inst);
end if;