Fix crash with misuse of display.

This commit is contained in:
Wilson Snyder
2022-05-15 09:29:45 -04:00
parent 89ec3d16dc
commit ae8d8ee1ac
2 changed files with 26 additions and 13 deletions
+2 -1
View File
@@ -308,7 +308,8 @@ void EmitCFunc::displayArg(AstNode* dispp, AstNode** elistp, bool isScan, const
}
emitDispState.pushFormat(pfmt);
if (!ignore) {
if (argp->dtypep()->basicp()->keyword() == VBasicDTypeKwd::STRING) {
if (argp->dtypep()->basicp()
&& argp->dtypep()->basicp()->keyword() == VBasicDTypeKwd::STRING) {
// string in SystemVerilog is std::string in C++ which is not POD
emitDispState.pushArg(' ', nullptr, "-1");
} else {