Skip to content

fix(soroban): skip empty CFGs in emit_functions_with_spec#1914

Open
0xull wants to merge 1 commit into
hyperledger-solang:mainfrom
0xull:soroban-fix-unused-modifier-panic
Open

fix(soroban): skip empty CFGs in emit_functions_with_spec#1914
0xull wants to merge 1 commit into
hyperledger-solang:mainfrom
0xull:soroban-fix-unused-modifier-panic

Conversation

@0xull

@0xull 0xull commented May 27, 2026

Copy link
Copy Markdown
Contributor

Description

an unused modifier produces a CFG with no basic blocks. the Soroban
emit path passed it to emit_cfg which called create_block and indexed
into the empty block list, panicking. the generic emit_functions path
already guards against this with cfg.is_placeholder(). apply the same
guard in emit_functions_with_spec.

Fix

one guard added in src/emit/soroban/mod.rs to skip any CFG where cfg.is_placeholder() returns true before passing it to emit_cfg.

Tests

one test in tests/soroban_testcases/modifiers.rs that compiles the exact MRE from the issue and invokes run() to show the contract is not only panic-free but executable.

Fixes #1906

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codegen panics on --target soroban when a contract declares an unused modifier

1 participant