Fix gcc array-bounds false positive in sequence event lowering

This commit is contained in:
Yilou Wang 2026-06-26 10:45:54 +02:00
parent 2b836858ef
commit 128d999871
2 changed files with 9 additions and 5 deletions

View File

@ -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;

View File

@ -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