Fix null pointer dereference after failing to extract DFF from memory.
authorCatherine <whitequark@whitequark.org>
Tue, 14 Dec 2021 16:27:37 +0000 (16:27 +0000)
committerCatherine <whitequark@whitequark.org>
Tue, 14 Dec 2021 16:27:37 +0000 (16:27 +0000)
Fixes #3110.

kernel/mem.cc

index 746f667ea77f6333d3edec14c127a0ef88768718..96168ff76b3949aae086b7c8f353a1bd471197ff 100644 (file)
@@ -985,7 +985,8 @@ Cell *Mem::extract_rdff(int idx, FfInitVals *initvals) {
                c = ff.emit();
        }
 
-       log("Extracted %s FF from read port %d of %s.%s: %s\n", trans_use_addr ? "addr" : "data",
+       if (c)
+               log("Extracted %s FF from read port %d of %s.%s: %s\n", trans_use_addr ? "addr" : "data",
                        idx, log_id(module), log_id(memid), log_id(c));
 
        port.en = State::S1;