[zeek/spicy] fb8296: Properly model switch case condition reads.

0 views
Skip to first unread message

Benjamin Bannier

unread,
Aug 26, 2025, 4:47:03 AMAug 26
to spicy-...@zeek.org
Branch: refs/heads/topic/bbannier/switch-cfg
Home: https://github.com/zeek/spicy
Commit: fb8296823390ed8316f7f799b2c64ed444bbac54
https://github.com/zeek/spicy/commit/fb8296823390ed8316f7f799b2c64ed444bbac54
Author: Benjamin Bannier <benjamin...@corelight.com>
Date: 2025-08-26 (Tue, 26 Aug 2025)

Changed paths:
M hilti/toolchain/src/compiler/cfg.cc
M tests/Baseline/hilti.cfg.switch/output

Log Message:
-----------
Properly model switch case condition reads.

For switch statements we synthesize a condition declaration and each
switch case we then perform equality checks. Previously we would only
store the case label in the CFG.

This patch fixes the implementation so we instead store the checks
against the condition variable. With that we properly model e.g., reads
of the condition variable which otherwise could appear unused.


Commit: 276123e6033246502d758b840615e07652c6b877
https://github.com/zeek/spicy/commit/276123e6033246502d758b840615e07652c6b877
Author: Benjamin Bannier <benjamin...@corelight.com>
Date: 2025-08-26 (Tue, 26 Aug 2025)

Changed paths:
M hilti/toolchain/src/compiler/cfg.cc
M tests/Baseline/hilti.cfg.switch/output

Log Message:
-----------
Fix CFG modelling of switch cases with multiple labels.

Switch cases with multiple labels were previously stored as a chain of
expressions which roughly corresponds to an AND. This patch fixes the
implementation to instead model them as separate branches which
corresponds to an OR and is closer to their actual behavior.


Compare: https://github.com/zeek/spicy/compare/fb8296823390%5E...276123e60332

To unsubscribe from these emails, change your notification settings at https://github.com/zeek/spicy/settings/notifications
Reply all
Reply to author
Forward
0 new messages