Minor compiler compatibility fixes

- Initialize variable to avoid 'may be uninitialized' warning
- More reliable segfault (the previous version was compiled into an
undefined instruction by clang sometimes, thew new one is always a store
to zero).
This commit is contained in:
Geza Lore 2021-06-12 23:03:32 +01:00
parent f0f68f42d1
commit b1c7de4ad5
2 changed files with 2 additions and 2 deletions

View File

@ -176,7 +176,7 @@ private:
void prepost_stmt_visit(AstNodeTriop* nodep) { void prepost_stmt_visit(AstNodeTriop* nodep) {
iterateChildren(nodep); iterateChildren(nodep);
AstNodeVarRef* varrefp; AstNodeVarRef* varrefp = nullptr;
if (m_unsupportedHere || !(varrefp = VN_CAST(nodep->rhsp(), VarRef))) { if (m_unsupportedHere || !(varrefp = VN_CAST(nodep->rhsp(), VarRef))) {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: Incrementation in this context."); nodep->v3warn(E_UNSUPPORTED, "Unsupported: Incrementation in this context.");
return; return;

View File

@ -815,7 +815,7 @@ string V3Options::protectKeyDefaulted() {
void V3Options::throwSigsegv() { // LCOV_EXCL_START void V3Options::throwSigsegv() { // LCOV_EXCL_START
#if !(defined(VL_CPPCHECK) || defined(__clang_analyzer__)) #if !(defined(VL_CPPCHECK) || defined(__clang_analyzer__))
// clang-format off // clang-format off
{ char* zp = nullptr; *zp = 0; } // Intentional core dump, ignore warnings here *static_cast<volatile char*>(nullptr) = 0; // Intentional core dump, ignore warnings here
// clang-format on // clang-format on
#endif #endif
} // LCOV_EXCL_STOP } // LCOV_EXCL_STOP