Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix Pretty not resetting all global state between calls #133

Merged
merged 2 commits into from
Feb 27, 2023
Merged

Conversation

sim642
Copy link
Member

@sim642 sim642 commented Feb 27, 2023

This fixes the long-standing oddity where Goblint prints warnings like

[Info][Imprecise] Invalidating expressions: AddrOf(Var(tmp,
                                     NoOffset)) (tests/regression/04-mutex/13-failed_locking.c:20:7-20:34)

despite using Pretty.sprint ~width:max_int, which should avoid such random line breaks.

The specific problem was that Pretty.breakAllMode was not being reset between different Pretty calls, so when it became active, following pretty-printing had such odd line breaks.

There were two more global variables in Pretty which were not being reset: topAlignAbsCol and aligns.
Now all global variables in Pretty are reset and restored properly.

breakAllMode persisting caused weird line breaks with max_int width in Goblint.
@sim642 sim642 added the bug label Feb 27, 2023
@sim642 sim642 merged commit eb64242 into develop Feb 27, 2023
@sim642 sim642 deleted the pretty-state branch February 27, 2023 15:49
@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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants