Fix string cast on array call

This commit is contained in:
Wilson Snyder
2026-03-04 20:12:10 -05:00
parent 4ff518de61
commit c93f5256d4
5 changed files with 76 additions and 7 deletions
+2 -1
View File
@@ -82,7 +82,8 @@ class CastVisitor final : public VNVisitor {
}
void ensureCast(AstNodeExpr* nodep) {
if (castSize(nodep->backp()) != castSize(nodep) || !nodep->user1()) {
if (!nodep->isNull()) insertCast(nodep, castSize(nodep->backp()));
if (!nodep->isNull() && !nodep->isString() && !nodep->isDouble())
insertCast(nodep, castSize(nodep->backp()));
}
}
// cppcheck-suppress constParameterPointer // lhsp might be changed