Skip to content

Conversation

@brianhuffman
Copy link
Contributor

@brianhuffman brianhuffman commented Oct 29, 2025

This is basically like PR #2743, but for LLVM. We now detect the following error conditions in LLVMSetup blocks:

  • duplicate llvm_execute_func declarations
  • missing llvm_execute_func declarations
  • missing llvm_return declaration on non-void function

This fixes the LLVM part of #2506.

Note that we still need a comprehensive regression test to exercise this and all other LLVMSetup error-checking code (#947); such a test is not included in this PR.

@brianhuffman
Copy link
Contributor Author

The new error checks broke a few of our integration tests, which included specs that had missing llvm_return or llvm_execute_func declarations. This suggests that it would be a good idea to mention the new requirements in the change log.

Copy link
Contributor

@sauclovian-g sauclovian-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM

Copy link
Contributor

@RyanGlScott RyanGlScott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please do mention this in the changelog. I suspect that this will actually break some proofs in the wild—rightfully so in some cases, but we should give some general advice on how to migrate these proofs.

Function crucible_execute_func is called internally by
llvm_execute_func, jvm_execute_func and mir_execute_func.
So this should detect duplicates of any of these.
The check should happen with both llvm_verify and
llvm_unsafe_assume_spec.
The following integration tests used LLVMSetup blocks with
missing llvm_return specifications, which are now required
if the function has a non-void return type.

* test0061_path_sat
* test0061_detect_vacuity
* test0067_term_eqs
* test_sanitize
An llvm_execute_func declaration is now required in all LLVMSetup
blocks.
@brianhuffman
Copy link
Contributor Author

I just noticed that the docstring for llvm_return, which is apparently unchanged since I wrote it in 2017 (5cdcf53) when it was called crucible_return, says, "A crucible_return statement is required if and only if the function has a non-void return type." Now in 2025 we are actually enforcing that requirement. :)


## Changes

* `llvm_verify` now enforces that an `llvm_return` specification is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This applies to jvm_verify as well, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it does. I'll add a note saying that the same applies to jvm_verify/jvm_return.

(Logically this entry ought to have been included as part of #2743.)
@brianhuffman brianhuffman merged commit 919d427 into master Oct 30, 2025
37 checks passed
@brianhuffman brianhuffman deleted the bh/llvm-setup-errors branch October 30, 2025 20:33
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.

4 participants