NumberAtReadFlow: catch starts from the try's entry state, so a non-Number write before a throw is not seen in the catch (suspected)

Aperta
#12,666 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Start in the number_by_construction pass and find how NumberAtReadFlow seeds the entry state for a catch block. First reproduce the example from the issue with node and with perry, since the report says the bug is unconfirmed. Done means the repro shows the mismatch and the catch entry state includes writes made inside the try before a throw.

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

Descrizione

bug parity

Found by review in the lblk lane (#12665); not yet reproduced. In number_by_construction's NumberAtReadFlow, a catch block starts from the state at try entry. A write that can make a local non-Number inside the try before a throw is therefore not joined into the catch, e.g.

function f(k) { let v = 1; try { v = k ? undefined : 2; if (k) throw 0; } catch (e) { return v + 1; } return v; }
console.log(f(1)); // node: NaN

Expected fix: the catch entry state is the join of the states at every point in the try that can throw (conservatively: the join of entry and every state reached in the try). Needs a repro run first.

Lingua principale
Rust
Stelle
4.9k
Fork
166
Merge medio
3h 6m
PR unite (30g)
868

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 PerryTS/perry

Tutte le issue di PerryTS/perry

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.