From c2f7e242b048ae2691681d62b099ecf9634d6407 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sat, 11 Jan 2020 07:43:03 +0100 Subject: synth-cleanup: avoid a crash on undriven output. Fix #1078 --- src/synth/netlists-cleanup.adb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/synth/netlists-cleanup.adb') 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; -- cgit v1.2.3