Skip to content

CPROVER library: __builtin_X falls back to the model of X - #9434

Open
tautschnig wants to merge 1 commit into
diffblue:developfrom
tautschnig:pr/c-builtin-fallback-to-model
Open

tautschnig wants to merge 1 commit into
diffblue:developfrom
tautschnig:pr/c-builtin-fallback-to-model

Conversation

@tautschnig

Copy link
Copy Markdown
Collaborator

GCC and Clang provide __builtin_X for the C library functions X with X's meaning (GCC manual, "Other Built-in Functions Provided by GCC"). The library modelled only a few of them (__builtin_fabs, ...); libc++'s calls __builtin_ceilf, __builtin_sqrt, ... and those had no body. get_cprover_library_text now gives a requested __builtin_X without a model of its own the model of X, with X renamed (as a whole word, outside #include lines). Models taking a va_list are not reused: where va_list is a struct (aarch64), the model's parameter type differs from the __builtin_va_list of a declaration, and linking left the model's va_list typedef unresolved.

New test cbmc/gcc_builtin_library_functions.

  • 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.

Copilot AI balanced review requested due to automatic review settings November 10, 2026 19:06

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.

GCC and Clang provide __builtin_X for the C library functions X with
X's meaning (GCC manual, "Other Built-in Functions Provided by GCC").
The library modelled only a few of them (__builtin_fabs, ...); libc++'s
<cmath> calls __builtin_ceilf, __builtin_sqrt, ... and those had no
body.  get_cprover_library_text now gives a requested __builtin_X
without a model of its own the model of X, with X renamed (as a whole
word, outside #include lines).  Models taking a va_list are not reused:
where va_list is a struct (aarch64), the model's parameter type differs
from the __builtin_va_list of a declaration, and linking left the
model's va_list typedef unresolved.

New test cbmc/gcc_builtin_library_functions (also for __builtin_strcmp,
__builtin_strlen and __builtin_memcmp, which thus need no model of
their own).

Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
@tautschnig
tautschnig force-pushed the pr/c-builtin-fallback-to-model branch from 2c4e896 to 25ef6df Compare November 10, 2026 20:17
@codecov

codecov Bot commented Nov 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.07692% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 81.03%. Comparing base (826c1c7) to head (25ef6df).
⚠️ Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
src/ansi-c/cprover_library.cpp 98.07% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #9434   +/-   ##
========================================
  Coverage    81.02%   81.03%           
========================================
  Files         1723     1723           
  Lines       191314   191366   +52     
  Branches        73       73           
========================================
+ Hits        155020   155070   +50     
- Misses       36294    36296    +2     

☔ 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