ZAM fix for inlining empty function bodies as the sole elements of an if-else

This commit is contained in:
Vern Paxson 2024-11-04 15:45:27 -08:00
parent a3a0155825
commit 286c4dc776
3 changed files with 30 additions and 2 deletions

View 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.
got through the conditional

View file

@ -0,0 +1,19 @@
# @TEST-DOC: Regression test for past ZAM issues with inlining empty functions in conditionals
#
# @TEST-EXEC: zeek -b -O ZAM %INPUT >output
# @TEST-EXEC: btest-diff output
function empty_func() {}
# Use a global to avoid constant propagation optimizing out the conditional.
global bar = F;
event zeek_init()
{
if ( bar )
empty_func();
else
empty_func();
print "got through the conditional";
}