From 239ef1ae6d4161a20e5b0f5b6d4b0bca889338a1 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Mon, 30 Sep 2019 20:00:30 -0400 Subject: [PATCH] Fix misc bad-syntax crashes, bug1533. --- Changes | 2 +- src/V3Ast.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index 8a0ffe606..abf2b9543 100644 --- a/Changes +++ b/Changes @@ -22,7 +22,7 @@ The contributors that suggested a given feature are shown in []. Thanks! **** Fix ugly error on interface misuse, bug1525. [Bogdan Vukobratovic] -**** Fix misc bad-syntax crashes, bug1529-bug1530, bug1532. [Eric Rippey] +**** Fix misc bad-syntax crashes, bug1529-bug1533. [Eric Rippey] * Verilator 4.018 2019-08-29 diff --git a/src/V3Ast.cpp b/src/V3Ast.cpp index bf9fd40ac..40bcf9d7a 100644 --- a/src/V3Ast.cpp +++ b/src/V3Ast.cpp @@ -113,7 +113,8 @@ string AstNode::encodeName(const string& namein) { // a user identifier nor a temp we create in Verilator. // We also do *NOT* use __DOT__ etc, as we search for those // in some replacements, and don't want to mangle the user's names. - char hex[10]; sprintf(hex, "__0%02X", pos[0]); + unsigned val = pos[0] & 0xff; // Mask to avoid sign extension + char hex[10]; sprintf(hex, "__0%02X", val); out += hex; } }