fix for script optimization of constants of type "opaque"

This commit is contained in:
Vern Paxson 2024-08-13 14:33:00 -07:00
parent 03347e235b
commit 5a3b519fb4
2 changed files with 14 additions and 3 deletions

View file

@ -474,7 +474,16 @@ public:
// Optimization-related:
ExprPtr Duplicate() override;
ValPtr FoldVal() const override { return val; }
ValPtr FoldVal() const override {
if ( type->Tag() == TYPE_OPAQUE )
// Aggressive constant propagation can lead to the appearance of
// opaque "constants". Don't consider these as foldable because
// they're problematic to generate independently.
return nullptr;
return val;
}
protected:
void ExprDescribe(ODesc* d) const override;