mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 19:48:20 +00:00
fix for ZAM optimization of assigning a record field to result of "in" operation
This commit is contained in:
parent
f940f2d88f
commit
6e549554b8
3 changed files with 25 additions and 1 deletions
|
@ -176,7 +176,6 @@ bool Expr::IsFieldAssignable(const Expr* e) const {
|
|||
case EXPR_RSHIFT:
|
||||
case EXPR_FIELD:
|
||||
case EXPR_HAS_FIELD:
|
||||
case EXPR_IN:
|
||||
case EXPR_SIZE:
|
||||
return true;
|
||||
|
||||
|
@ -189,6 +188,8 @@ bool Expr::IsFieldAssignable(const Expr* e) const {
|
|||
// case EXPR_NE:
|
||||
// case EXPR_GE:
|
||||
// case EXPR_GT:
|
||||
//
|
||||
// case EXPR_IN:
|
||||
|
||||
// These could be added if we subsetted them to versions for
|
||||
// which we know it's safe to evaluate both operands. Again
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
nope
|
21
testing/btest/opt/regress-field-assign-in-op.zeek
Normal file
21
testing/btest/opt/regress-field-assign-in-op.zeek
Normal file
|
@ -0,0 +1,21 @@
|
|||
# @TEST-DOC: Regression test for assigning a record field to an "in" operation
|
||||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||
# @TEST-EXEC: zeek -b -O ZAM %INPUT >output
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
type r1: record {
|
||||
is_free: bool;
|
||||
};
|
||||
|
||||
type r2: record {
|
||||
s: string;
|
||||
ss: string_set;
|
||||
};
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local l1 = r1($is_free = F);
|
||||
local l2 = r2($s="foo", $ss=set("bar", "bletch"));
|
||||
l1$is_free = l2$s in l2$ss;
|
||||
print l1$is_free ? "yep" : "nope";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue