macro_via: disjunctive #undef terminators leave dead macros live

Aperta
#193 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
compilers

Direzione di ricerca

Start with src/database/macro_via.rs and read the deferred change in commit a2fe71e, focusing on guard overlap and how #undef terminators are handled. Use the C reproducer to check callers of target; done means the query no longer reports a via RUN edge when the combined #undef RUN guards cover every build.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

When a function-like macro is #undef'd across multiple complementary preprocessor branches, macro_via treats each terminator independently and leaves the macro live, producing a false caller edge.

Reproducer

int target(void) { return 1; }
#define RUN(f) f()
#define FLAG 1
#if BRANCH
#undef RUN
#undef FLAG
#endif
#ifdef FLAG
#undef RUN
#endif
int caller(void) { return RUN(target); }

Querying callers of target reports caller via RUN, even though RUN is undefined in every build (BRANCH undefines RUN and FLAG; !BRANCH keeps FLAG defined and undefines RUN).

Cause

Deferred in a2fe71e: each #undef is uncertain on its own, and the guard overlap engine in src/database/macro_via.rs does not yet prove disjunctive terminator coverage across branches.

Expected behavior

callers target should not report a via RUN edge when the union of #undef RUN guards covers every build.

Lingua principale
Rust
Stelle
187
Fork
53
Merge medio
1g 9h
PR unite (30g)
79

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di facebookexperimental/semcode

Tutte le issue di facebookexperimental/semcode

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.