Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add return statements in noreturn functions #129

Merged

Conversation

just-max
Copy link

(Option to) add always add return statements in functions that fall through, specifically those marked noreturn. The justification for adding this change to CIL: currently CIL always adds a return statement if it is at all possible for the function to reach the end of its body. For noreturn functions, however, it trusts that these functions never reach their end. This makes the behaviour arguably more consistent between functions marked noreturn and functions that are not.

Fixes goblint/analyzer#951. Fixes the issue blocking goblint/analyzer#953. See also goblint/analyzer#953 (comment).

(option to) add always add return statements in functions that fall through, specifically those marked noreturn
Copy link
Member

@michael-schwarz michael-schwarz left a comment

Choose a reason for hiding this comment

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

Looks reasonable, thank you for the PR!

@michael-schwarz
Copy link
Member

@just-max: any reason this is still marked as a draft?

@just-max
Copy link
Author

I haven't gotten around to testing the changes yet, especially how they interact with the changes in Goblint, so I'd wait for that before merging here.

@just-max just-max marked this pull request as ready for review January 31, 2023 18:28
@michael-schwarz michael-schwarz merged commit c03ade1 into goblint:develop Feb 1, 2023
@sim642 sim642 added this to the 2.0.2 milestone Apr 5, 2023
sim642 added a commit to sim642/opam-repository that referenced this pull request Sep 11, 2023
CHANGES:

* Rename `Rmtmps` to `RmUnused` (goblint/cil#135).
* Add option to add return statement to `noreturn` functions (goblint/cil#129).
* Fix empty `if`s being removed (goblint/cil#140).
* Fix `_Float128` support (goblint/cil#118, goblint/cil#119).
* Fix C11 `_Alignas` computation (goblint/cil#130).
* Fix renaming and merging of `inline` functions based on C standard (goblint/cil#120, goblint/cil#124).
* Fix `Pretty` not resetting all global state between calls (goblint/cil#133, goblint/cil#134).
* Fix `fundec` location in merger (goblint/cil#139).
* Fix `cilly` patcher (goblint/cil#128).
* Disable basename by default in parser.
nberth pushed a commit to nberth/opam-repository that referenced this pull request Jun 18, 2024
CHANGES:

* Rename `Rmtmps` to `RmUnused` (goblint/cil#135).
* Add option to add return statement to `noreturn` functions (goblint/cil#129).
* Fix empty `if`s being removed (goblint/cil#140).
* Fix `_Float128` support (goblint/cil#118, goblint/cil#119).
* Fix C11 `_Alignas` computation (goblint/cil#130).
* Fix renaming and merging of `inline` functions based on C standard (goblint/cil#120, goblint/cil#124).
* Fix `Pretty` not resetting all global state between calls (goblint/cil#133, goblint/cil#134).
* Fix `fundec` location in merger (goblint/cil#139).
* Fix `cilly` patcher (goblint/cil#128).
* Disable basename by default in parser.
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty functions marked noreturn cause crash
3 participants