Skip to content

Add goblint_cil_pulledup attribute to static local variables pulled up to global scope#226

Open
Copilot wants to merge 2 commits intodevelopfrom
copilot/add-goblint-cil-pulledup-attribute
Open

Add goblint_cil_pulledup attribute to static local variables pulled up to global scope#226
Copilot wants to merge 2 commits intodevelopfrom
copilot/add-goblint-cil-pulledup-attribute

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 12, 2026

CIL promotes static local variables to globals, making them indistinguishable from true globals. This adds a goblint_cil_pulledup attribute to such variables so consumers (e.g. goblint analyzer) can identify them.

Changes

  • src/frontc/cabs2cil.ml: In the sto = Static && !makeStaticGlobal branch where local statics are promoted to globals, stamp the resulting varinfo with Attr("goblint_cil_pulledup", []) — mirrors the existing goblint_cil_nested pattern.

Example

Given:

void foo() {
    static int counter = 0;  // pulled up to global scope by CIL
    counter++;
}

The resulting global varinfo for counter will carry __attribute__((goblint_cil_pulledup)), allowing downstream tools to distinguish it from a genuinely file-scoped global.

…lobal scope

Agent-Logs-Url: https://github.com/goblint/cil/sessions/dde67fb6-9ca2-4e8d-b3b8-3717c48d96a1

Co-authored-by: michael-schwarz <13812333+michael-schwarz@users.noreply.github.com>
Copilot AI changed the title [WIP] Add attribute goblint_cil_pulledup to static variables Add goblint_cil_pulledup attribute to static local variables pulled up to global scope Apr 12, 2026
Copilot AI requested a review from michael-schwarz April 12, 2026 07:11
@michael-schwarz michael-schwarz marked this pull request as ready for review April 12, 2026 07:16
@michael-schwarz michael-schwarz requested a review from sim642 April 12, 2026 07:16
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.

Add attribute goblint_cil_pulledup to static variables that are not globals

2 participants