diff --git a/frontends/p4/moveDeclarations.cpp b/frontends/p4/moveDeclarations.cpp index d6c7f5f0e2..12b366a723 100644 --- a/frontends/p4/moveDeclarations.cpp +++ b/frontends/p4/moveDeclarations.cpp @@ -180,6 +180,8 @@ const IR::Node *MoveInitializers::postorder(IR::ParserState *state) { } const IR::Node *MoveInitializers::postorder(IR::Path *path) { + if (!findContext()) return path; + if (!oldStart || !loopsBackToStart || path->name != IR::ParserState::start) return path; // Only rename start state references if the parser contains initializing assignments