Fix constant folding for multi-dimensional array pattern initialisation

This commit is contained in:
Greg Davill 2026-04-10 08:58:06 +09:30
parent 0517a48688
commit 111998409b
No known key found for this signature in database
GPG Key ID: 80EE31ACCEBEA6DA
1 changed files with 6 additions and 0 deletions

View File

@ -3026,6 +3026,12 @@ class ConstVisitor final : public VNVisitor {
void visit(AstArraySel* nodep) override {
iterateAndNextNull(nodep->bitp());
// Multi-dimensional param array access (fromp is a chain of ArraySels):
// delegate to V3Simulate to natively handles InitArray chains
if (m_required && VN_IS(nodep->fromp(), ArraySel)) {
replaceWithSimulation(nodep);
return;
}
if (VN_IS(nodep->bitp(), Const)
&& VN_IS(nodep->fromp(), VarRef)
// Need to make sure it's an array object so don't mis-allow a constant (bug509.)