Skip to content

Simplifier: a sizeof factor of one keeps its annotation - #9421

Open
tautschnig wants to merge 1 commit into
diffblue:developfrom
tautschnig:pr/simplify-sizeof-factor-one
Open

tautschnig wants to merge 1 commit into
diffblue:developfrom
tautschnig:pr/simplify-sizeof-factor-one

Conversation

@tautschnig

Copy link
Copy Markdown
Collaborator

symex_allocate takes the element type of malloc(sizeof(T) * n)' from the product's sizeof annotation. simplify_mult deleted a factor of one together with its annotation, so with n a constant computed from another sizeof -- sizeof(char) * (5 * sizeof(long))', as libstdc++'s num_put::_M_insert_int allocates its digit buffer -- the object became a long[5], and every char store a byte_update that constant propagation could not see through. The factor is still deleted (kept, it would leave 1 * n' in the formula of every char allocation), but its annotation moves onto the product; and a typecast simplified to a constant keeps its own annotation over its operand's, so (size_t)ilen' stays a char size once ilen is propagated. New test cbmc/alloca_sizeof_char_times_sizeof_constant.

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a 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.

Copilot AI balanced review requested due to automatic review settings November 10, 2026 14:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

symex_allocate takes the element type of `malloc(sizeof(T) * n)' from
the product's sizeof annotation.  simplify_mult deleted a factor of one
together with its annotation, so with n a constant computed from another
sizeof -- `sizeof(char) * (5 * sizeof(long))', as libstdc++'s
num_put::_M_insert_int allocates its digit buffer -- the object became a
long[5], and every char store a byte_update that constant propagation
could not see through.  The factor is still deleted (kept, it would
leave `1 * n' in the formula of every char allocation), but its
annotation moves onto the product; and a typecast simplified to a
constant keeps its own annotation over its operand's, so `(size_t)ilen'
stays a char size once ilen is propagated.  New test
cbmc/alloca_sizeof_char_times_sizeof_constant.

Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
@tautschnig
tautschnig force-pushed the pr/simplify-sizeof-factor-one branch from 36fbc0c to 9ea6cd6 Compare November 10, 2026 15:33
@codecov

codecov Bot commented Nov 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.02%. Comparing base (826c1c7) to head (9ea6cd6).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9421      +/-   ##
===========================================
- Coverage    81.02%   81.02%   -0.01%     
===========================================
  Files         1723     1723              
  Lines       191314   191321       +7     
  Branches        73       73              
===========================================
+ Hits        155020   155024       +4     
- Misses       36294    36297       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
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.

2 participants