mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 22:58:20 +00:00
fix & btest for ZAM bug with inlined nested loop
This commit is contained in:
parent
aa8f11fa17
commit
84dc430e00
3 changed files with 27 additions and 1 deletions
|
@ -261,7 +261,7 @@ void ZAMCompiler::ComputeLoopLevels()
|
||||||
// We're extending an existing loop. Find
|
// We're extending an existing loop. Find
|
||||||
// its current end.
|
// its current end.
|
||||||
auto depth = t->loop_depth;
|
auto depth = t->loop_depth;
|
||||||
while ( j < i && insts1[j]->loop_depth == depth )
|
while ( j < i && insts1[j]->loop_depth >= depth )
|
||||||
++j;
|
++j;
|
||||||
|
|
||||||
ASSERT(insts1[j]->loop_depth == depth - 1);
|
ASSERT(insts1[j]->loop_depth == depth - 1);
|
||||||
|
|
2
testing/btest/Baseline/language.inlined-nested-loop/out
Normal file
2
testing/btest/Baseline/language.inlined-nested-loop/out
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
|
I compiled and ran!
|
24
testing/btest/language/inlined-nested-loop.zeek
Normal file
24
testing/btest/language/inlined-nested-loop.zeek
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# @TEST-EXEC: zeek -b %INPUT >out
|
||||||
|
# @TEST-EXEC: btest-diff out
|
||||||
|
|
||||||
|
# This used to lead to an assertion failure in the ZAM compiler due to
|
||||||
|
# a bug in how it computed the lifetime of loops nested via inlining.
|
||||||
|
|
||||||
|
function is_local(host: addr): bool
|
||||||
|
{
|
||||||
|
for ( local_net in set(10.0.0.0/8) )
|
||||||
|
if ( host in local_net )
|
||||||
|
return T;
|
||||||
|
return F;
|
||||||
|
}
|
||||||
|
|
||||||
|
event zeek_init()
|
||||||
|
{
|
||||||
|
for ( host_addr in set(127.0.0.1) )
|
||||||
|
{
|
||||||
|
if ( is_local(host_addr) )
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
print "I compiled and ran!";
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue