diff --git a/tgt-vhdl/vhdl_syntax.cc b/tgt-vhdl/vhdl_syntax.cc index 3935c0bd7..0af19d8b4 100644 --- a/tgt-vhdl/vhdl_syntax.cc +++ b/tgt-vhdl/vhdl_syntax.cc @@ -631,8 +631,10 @@ void vhdl_if_stmt::emit(std::ofstream &of, int level) const test_->emit(of, level); of << " then"; then_part_.emit(of, level); - of << "else"; - else_part_.emit(of, level); + if (!else_part_.empty()) { + of << "else"; + else_part_.emit(of, level); + } of << "end if;"; }