mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Fix for ZAM optimization of '?' conditional with vector-valued result
This commit is contained in:
parent
ee88aa3acb
commit
0706e8869d
3 changed files with 11 additions and 1 deletions
|
@ -227,7 +227,7 @@ const ZAMStmt ZAMCompiler::CompileAssignExpr(const AssignExpr* e)
|
||||||
return CondC2VVC(lhs, n1, c3);
|
return CondC2VVC(lhs, n1, c3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( r1 && r2 )
|
if ( r1 && r2 && ! r3 )
|
||||||
{
|
{
|
||||||
auto v1 = IsVector(r1->GetType()->Tag());
|
auto v1 = IsVector(r1->GetType()->Tag());
|
||||||
auto v2 = IsVector(r2->GetType()->Tag());
|
auto v2 = IsVector(r2->GetType()->Tag());
|
||||||
|
|
|
@ -13,3 +13,4 @@ associativity (PASS)
|
||||||
0, vector of string
|
0, vector of string
|
||||||
0, vector of string
|
0, vector of string
|
||||||
[1, 5, 3], vector of count
|
[1, 5, 3], vector of count
|
||||||
|
[4, 5, 6], vector of count
|
||||||
|
|
|
@ -20,6 +20,11 @@ function f2(): bool
|
||||||
return F;
|
return F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# The following needs to be a global to test for a ZAM regression where
|
||||||
|
# the ZAM optimizer will optimize away the problematic condition if the
|
||||||
|
# value is constant.
|
||||||
|
global false = F;
|
||||||
|
|
||||||
event zeek_init()
|
event zeek_init()
|
||||||
{
|
{
|
||||||
local a: count;
|
local a: count;
|
||||||
|
@ -86,4 +91,8 @@ event zeek_init()
|
||||||
local tvc = vector(T, F, T);
|
local tvc = vector(T, F, T);
|
||||||
local tvr = tvc ? vector(1, 2, 3) : vector(4, 5, 6);
|
local tvr = tvc ? vector(1, 2, 3) : vector(4, 5, 6);
|
||||||
print tvr, type_name(tvr);
|
print tvr, type_name(tvr);
|
||||||
|
|
||||||
|
# Test for ternary results
|
||||||
|
local tvr2 = false ? vector(1, 2, 3) : vector(4, 5, 6);
|
||||||
|
print tvr2, type_name(tvr2);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue