Skip to content

Memory allocations produced via alloca have function scope #7375

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

Merged
merged 1 commit into from
Nov 24, 2022

Conversation

tautschnig
Copy link
Collaborator

We must not mark the allocation as dead when leaving the block, but instead need to defer that until the end of the function.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@codecov
Copy link

codecov bot commented Nov 23, 2022

Codecov Report

Base: 78.35% // Head: 78.35% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (d397f58) compared to base (c7550b6).
Patch coverage: 98.07% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #7375   +/-   ##
========================================
  Coverage    78.35%   78.35%           
========================================
  Files         1645     1645           
  Lines       190182   190208   +26     
========================================
+ Hits        149015   149040   +25     
- Misses       41167    41168    +1     
Impacted Files Coverage Δ
src/goto-programs/goto_convert_class.h 88.15% <ø> (ø)
src/goto-programs/builtin_functions.cpp 60.02% <97.91%> (+1.01%) ⬆️
src/goto-programs/goto_convert_functions.cpp 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.


typedef int *int_ptr;

int main()
Copy link
Member

Choose a reason for hiding this comment

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

Do we need a second test that checks deallocation when returning from the function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point, I'll expand the test to that effect (even though I do think we cover this case in the test alloca-02).

@peterschrammel peterschrammel removed their assignment Nov 23, 2022
@tautschnig tautschnig assigned tautschnig and unassigned kroening Nov 23, 2022
We must not mark the allocation as dead when leaving the block, but
instead need to defer that until the end of the function.
@tautschnig tautschnig merged commit 3277cf3 into diffblue:develop Nov 24, 2022
@tautschnig tautschnig deleted the bugfixes/alloca branch November 24, 2022 08:13
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.

3 participants