From 128d999871136ee0f7685f9619752bea97d7b650 Mon Sep 17 00:00:00 2001 From: Yilou Wang Date: Fri, 26 Jun 2026 10:45:54 +0200 Subject: [PATCH] Fix gcc array-bounds false positive in sequence event lowering --- src/V3AssertNfa.cpp | 7 ++++++- test_regress/t/t_sequence_ref_unsup.out | 7 +++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/V3AssertNfa.cpp b/src/V3AssertNfa.cpp index 4eaef46dd..a495a7d10 100644 --- a/src/V3AssertNfa.cpp +++ b/src/V3AssertNfa.cpp @@ -2756,8 +2756,13 @@ class AssertNfaVisitor final : public VNVisitor { // Reuse the assertion machinery to inline the sequence body and hoist // its clocking event; this also clears the sequence's isReferenced flag. + // Inline the referenced sequence first, then any nested sequence refs in + // its body -- foreaching over specp->propp() (a member access) rather than + // the freshly allocated specp keeps gcc -Warray-bounds from a false match. + AstSequence* const seqp = VN_AS(funcrefp->taskp(), Sequence); AstPropSpec* const specp = new AstPropSpec{flp, nullptr, nullptr, funcrefp}; - inlineAllSequenceRefs(specp); + inlineSequenceRef(funcrefp, seqp); + inlineAllSequenceRefs(specp->propp()); if (hoistClockedSeq(specp)) { // Unsupported clocking form, already reported VL_DO_DANGLING(pushDeletep(specp), specp); return; diff --git a/test_regress/t/t_sequence_ref_unsup.out b/test_regress/t/t_sequence_ref_unsup.out index 41fb50aad..53e0c6f4c 100644 --- a/test_regress/t/t_sequence_ref_unsup.out +++ b/test_regress/t/t_sequence_ref_unsup.out @@ -1,6 +1,5 @@ -%Error-UNSUPPORTED: t/t_sequence_ref_unsup.v:9:12: Unsupported: sequence referenced outside assertion property - : ... note: In instance 't' - 9 | sequence s_one; - | ^~~~~ +%Error-UNSUPPORTED: t/t_sequence_ref_unsup.v:14:6: Unsupported: '@' event control on a sequence without a clocking event + 14 | @s_one; + | ^~~~~ ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest %Error: Exiting due to