charmxi segfaults on a declared CkMigrateMessage constructor entry (null member in AST, isTramTarget)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
Direzione di ricerca
Read the constructor entry rule near the warning in src/xlat-i/xi-grammar.y, then trace how it adds members to the AST and how isTramTarget() traverses them in src/xlat-i/xi-AstNode.h. Reproduce with the supplied interface and add a regression test under tests/charm++/charmxi_parsing; done means charmxi no longer segfaults on the declared migration constructor and the test passes.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
charmxi segfaults on an interface file that declares a migration constructor as an entry method, right after printing the warning that such a constructor is taken for granted. Reproduces on recharm (4ad7320be, reconverse-darwin-arm8) and on a classic netlrts-darwin-arm8-smp build.
Reproducer
mainmodule Y {
array [1D] Cell {
entry Cell();
entry Cell(CkMigrateMessage* m);
};
};
$ charmxi Y.ci
Y.ci:4:5-36: warning: CkMigrateMsg chare constructor is taken for granted
...
Segmentation fault (exit 139)
Backtrace (lldb): EXC_BAD_ACCESS address=0x0 in xi::AstChildren<xi::Member>::isTramTarget().
Cause
The grammar rule for a constructor entry (src/xlat-i/xi-grammar.y, the ENTRY Name EParameters ... alternative near the warning) sets $$ = NULL after warning, so the chare's member list contains a null Member*. The traversals written since then guard against that (genGlobalCode, genTramPups in src/xlat-i/xi-AstNode.h test if (*i)), but AstChildren<Child>::isTramTarget() (added with [aggregate] support in 1225c6d78, 2017) dereferences every child without the check. The warning itself dates from 2015, so declaring the migration constructor has crashed charmxi since 2017 rather than being tolerated as the warning implies.
Two secondary defects in the same rule: the warning is attributed to the wrong line (the next entry's line when one follows, since lineno has already advanced past the semicolon), and the entry is dropped instead of being accepted with a warning, which is why old code and tutorials that declare entry X(CkMigrateMessage*) only work when nothing else in the module triggers the TRAM scan.
Suggested fix
Either do not push the null into the member list (accept the entry and ignore it in code generation, or drop it at the point the list is built), or add the if (*i) guard to isTramTarget() as in the other traversals. The first is better: a null child in the AST is what every later traversal has to work around. A regression test belongs in tests/charm++/charmxi_parsing (added by #4027).
Found while evaluating an external translator that emits this declaration; not specific to that tool.
- Lingua principale
- C++
- Stelle
- 241
- Fork
- 62
- Merge medio
- 1g 1h
- PR unite (30g)
- 121
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di charmplusplus/charm
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
charmplusplus/charm#4210 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
charmplusplus/charm#4160 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
charmplusplus/charm#3619 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
charmplusplus/charm#4204 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 49/100
charmplusplus/charm#4200 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di charmplusplus/charm
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
bug test
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
OpenAssetIO/OpenAssetIO#1527 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
ROCm/rocm-systems#15475 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
Sendspin/sendspin-cpp#257 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
pocoproject/poco#5664 ·
I maintainer di solito rispondono entro 2 giorni