On 2010-12-12, a local commit was made: "latch synthesis fix: Connect q and data pins in netlist." Testing had shown that FNF output was more correct than before this commit, but the changes were causing new ivtest failures. Exploration was begun into some apparent issues with the FNF, which was ultimately proven to be perfect, and the ivtest failures (basiclatch) were determined to be VVP-related.
Meanwhile, a parallel effort was initiated to resolve the VVP issues. That effort resulted in several patches since 2010-12-12, some of which were in the same area as the latch synthesis fix mentioned above. In fact, those patches obsoleted the 2010-12-12 local commit as described.
However, there were certain robustness improvements included in that local commit that were not obsoleted. After a pull, manual conflict resolution and thorough testing, those improvements are preserved by this patch and are as follows:
Check for zero-width vector.
Replace assertions with exceptions.
Use C++-style cast.
Use suffix for unsigned integer constants.
Catch bad_alloc exception.
I have not looked at the patch, but the Icarus code in general uses assertions instead of exceptions. It usually uses C instead of C++ casts and does not catch bad_alloc. In general we try to keep the code consistent vs making changes like this, but as always Steve has the final decision. Adding this may negatively impact the inclusion of this code in a future version of Icarus with working Synthesis. Yes we know how to use these constructs, but we purposely choose not to.
I think that it does make sense to replace the C casts to C++ style casts over time, but I'm not of the mind to replace asserts with exceptions. In fact the assertion implementation in later versions is further improved to include things like file/line of the Verilog source that is being processed when the assertion tripped, and things like that. In any case, I *intend* the program to die and leave a stack trace when assertions fail, so I'd just as soon leave the assertions unchanged.
identical, but assertions replace exceptions