Skip to content

Add warnings about missing function declarations#1911

Open
sim642 wants to merge 5 commits intomasterfrom
fundec-missingproto-warn
Open

Add warnings about missing function declarations#1911
sim642 wants to merge 5 commits intomasterfrom
fundec-missingproto-warn

Conversation

@sim642
Copy link
Member

@sim642 sim642 commented Jan 16, 2026

This is allowed by older versions of C.
These functions are assumed to return int, etc, which can cause internal type mismatches for standard functions.
For example, it's a problem if llabs gets return type int by CIL, but Goblint assumes it to be long long. This causes missing/extra/wrong implicit casts to be inserted, leading to ikind errors and whatnot.

This is allowed by older versions of C.
These functions are assumed to return int, etc, which can cause internal type mismatches for standard functions.
Copilot AI review requested due to automatic review settings March 12, 2026 10:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds analyzer warnings for calls to functions that lack a proper prior declaration/prototype (old-C implicit declarations / non-prototype declarations), because the assumed default types can lead to internal type mismatches (e.g., incorrect casts and ikind errors). It also updates many regression tests to include the relevant headers (and adjusts golden outputs) so that standard/library function prototypes are available.

Changes:

  • Emit warnings when calling a function whose CIL type is marked with the missingproto attribute.
  • Extend special-casing of known globals and adjust race analysis handling of free casts.
  • Update a broad set of regression tests by adding missing #includes and updating expected outputs/locations.

Reviewed changes

Copilot reviewed 264 out of 264 changed files in this pull request and generated 5 comments.

File Description
src/framework/constraints.ml Emits warnings (msg_final + per-callsite warning) when a called function has missingproto.
src/framework/control.ml Treats __mb_cur_max as a special global (MacOS compatibility).
src/analyses/raceAnalysis.ml Strips outer implicit void* cast for free access events to preserve underlying pointer type.
tests/regression/** Adds missing standard/Goblint headers and updates golden outputs/line numbers to account for the new warnings and include shifts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sim642 sim642 marked this pull request as ready for review March 12, 2026 14:38
Copilot AI review requested due to automatic review settings March 12, 2026 14:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 264 out of 264 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants