mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Merge remote-tracking branch 'origin/topic/vern/ZAM-maint.May25'
* origin/topic/vern/ZAM-maint.May25: fix for crash when interpreting transformed ASTs that include multi-field record assignments/additions Remove unused ZAM compiler method
This commit is contained in:
commit
3282bbc429
7 changed files with 44 additions and 6 deletions
6
CHANGES
6
CHANGES
|
@ -1,3 +1,9 @@
|
|||
8.0.0-dev.299 | 2025-05-30 13:06:42 -0700
|
||||
|
||||
* fix for crash when interpreting transformed ASTs that include multi-field record assignments/additions (Vern Paxson, Corelight)
|
||||
|
||||
* Remove unused ZAM compiler method (Vern Paxson, Corelight)
|
||||
|
||||
8.0.0-dev.296 | 2025-05-30 12:16:27 -0700
|
||||
|
||||
* Add utility methods to make CMake summary output nicer (Tim Wojtulewicz, Corelight)
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
8.0.0-dev.296
|
||||
8.0.0-dev.299
|
||||
|
|
|
@ -2951,6 +2951,8 @@ RecordFieldUpdatesExpr::RecordFieldUpdatesExpr(ExprTag t, const std::vector<cons
|
|||
ASSERT(stmt_pool.count(s) > 0);
|
||||
stmt_pool.erase(s);
|
||||
}
|
||||
|
||||
SetType(base_type(TYPE_VOID));
|
||||
}
|
||||
|
||||
RecordFieldUpdatesExpr::RecordFieldUpdatesExpr(ExprTag t, ExprPtr e1, ExprPtr e2, std::vector<int> _lhs_map,
|
||||
|
@ -2958,6 +2960,7 @@ RecordFieldUpdatesExpr::RecordFieldUpdatesExpr(ExprTag t, ExprPtr e1, ExprPtr e2
|
|||
: BinaryExpr(t, std::move(e1), std::move(e2)) {
|
||||
lhs_map = std::move(_lhs_map);
|
||||
rhs_map = std::move(_rhs_map);
|
||||
SetType(base_type(TYPE_VOID));
|
||||
}
|
||||
|
||||
ValPtr RecordFieldUpdatesExpr::Fold(Val* v1, Val* v2) const {
|
||||
|
|
|
@ -183,6 +183,4 @@ const Stmt* ZAMCompiler::LastStmt(const Stmt* s) const {
|
|||
return s;
|
||||
}
|
||||
|
||||
ZAMStmt ZAMCompiler::PrevStmt(const ZAMStmt s) { return ZAMStmt(s.stmt_num - 1); }
|
||||
|
||||
} // namespace zeek::detail
|
||||
|
|
|
@ -31,9 +31,6 @@ int InternalAddVal(ZInstAux* zi, int i, Expr* e);
|
|||
// global/capture store for this instruction.
|
||||
const ZAMStmt AddInst(const ZInstI& inst, bool suppress_non_local = false);
|
||||
|
||||
// Returns the statement just before the given one.
|
||||
ZAMStmt PrevStmt(const ZAMStmt s);
|
||||
|
||||
// Returns the last (interpreter) statement in the body.
|
||||
const Stmt* LastStmt(const Stmt* s) const;
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
[a=37, b=47]
|
||||
[a=4, b=3]
|
31
testing/btest/opt/regress-record-multi-assign.zeek
Normal file
31
testing/btest/opt/regress-record-multi-assign.zeek
Normal file
|
@ -0,0 +1,31 @@
|
|||
# @TEST-DOC: Regression test for assigning multiple fields in a record
|
||||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||
# @TEST-EXEC: zeek -b -O xform %INPUT >output
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
type R: record {
|
||||
a: count;
|
||||
b: count;
|
||||
};
|
||||
|
||||
function multi_add(x: R, y: R): R
|
||||
{
|
||||
y$a += x$b;
|
||||
y$b += x$a;
|
||||
return y;
|
||||
}
|
||||
|
||||
function multi_assign(x: R, y: R): R
|
||||
{
|
||||
y$a = x$b;
|
||||
y$b = x$a;
|
||||
return y;
|
||||
}
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local x = R($a=3, $b=4);
|
||||
local y = R($a=33, $b=44);
|
||||
print multi_add(x, y);
|
||||
print multi_assign(x, y);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue