Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

V3 interpreter: ClassCastException (DF64 → DI64) after catch_all of an exception with a payload

Chiusa
#705 2 commenti 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
45/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java, wasm
Ambito
compilers

Direzione di ricerca

The issue is in the V3 interpreter's exception handling. Look at the code for try_table and catch_all in the interpreter (likely in V3C_V3Interpreter.java). The problem is that after a catch_all, the operand stack may incorrectly contain the exception payload. Start by tracing the execution of the provided WASM module, focusing on how values are pushed/popped around the try_table block. Check the unbox_w method in V3K_Values.java for the casting error. Verify the fix by running the repro.wasm test and ensuring it returns 0.

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

Descrizione

The V3 interpreter throws a Java ClassCastException on a valid module that catches an exception with catch_all.

Reproduced on: 5e91335 (2026-09-21), JVM build (build.sh wizeng jvm); the only later commit, 10ca71f, is docs-only.

Module (reduced automatically from a generated program; validates with wasm-tools validate):

(module
  (type (;0;) (func))
  (type (;1;) (func (param i32)))
  (type (;2;) (func (param i64)))
  (type (;3;) (func (param f64)))
  (type (;4;) (func (param v128)))
  (type (;5;) (func (param i64 i32)))
  (type (;6;) (func (param f32 v128 i64)))
  (type (;7;) (func (param i32 i64 f32 f64 v128)))
  (type (;8;) (func (result i64)))
  (tag $tag0 (;0;) (type 0))
  (tag $tag1 (;1;) (type 1) (param i32))
  (tag $tag2 (;2;) (type 2) (param i64))
  (tag $tag3 (;3;) (type 3) (param f64))
  (tag $tag4 (;4;) (type 4) (param v128))
  (tag $tag5 (;5;) (type 5) (param i64 i32))
  (tag $tag6 (;6;) (type 6) (param f32 v128 i64))
  (tag $tag7 (;7;) (type 7) (param i32 i64 f32 f64 v128))
  (global $g (;0;) (mut i64) i64.const 4660)
  (export "x" (func 1))
  (func $e0 (;0;) (type 8) (result i64)
    (local $h i64) (local $vi320 i32) (local $vi321 i32) (local $vi322 i32) (local $vi640 i64) (local $vi641 i64) (local $vi642 i64) (local $vf320 f32) (local $vf321 f32) (local $vf322 f32) (local $vf640 f64) (local $vf641 f64) (local $vf642 f64) (local $vv1280 v128) (local $vv1281 v128) (local $vv1282 v128) (local $x0 exnref) (local $x1 v128) (local $i1 i32) (local $x3 v128) (local $x4 f64)
    local.get $h
    i64x2.splat
    i64x2.extract_lane 0
    block $L13
      try_table (catch_all $L13) ;; label = @2
        local.get $vi640
        i64.const 174
        i64.lt_u
        if (result f64) ;; label = @3
          global.get $g
          f64.reinterpret_i64
          throw $tag3
        else
          local.get $h
          f64.reinterpret_i64
        end
        i64.reinterpret_f64
        local.set $h
      end
    end
    local.get $h
    i64x2.splat
    i64x2.extract_lane 1
    i64.xor
    local.set $h
    local.get $h
  )
  (func (;1;) (type 8) (result i64)
    call $e0
  )
)
$ wizeng --invoke=x --print-result repro.wasm
Exception in thread "main" java.lang.ClassCastException: class V3C_Value$DF64 cannot be cast to class V3C_Value$DI64
	at V3K_Values.unbox_w(Unknown Source)
	at V3C_V3Interpreter.do_ww_w(Unknown Source)
	at V3C_V3Interpreter.execOp(Unknown Source)

Expected: 0. wasmtime and V8 (node 26) both return 0.

What the module does: an i64 is live on the operand stack below block $L13. Inside it, try_table (catch_all $L13) throws $tag3, whose payload is an f64. After the catch, the following i64.xor gets an f64 operand. It looks as if the tag's payload is left on the operand stack when catch_all branches to its label. That's only a guess from the symptom; I haven't looked at the interpreter code.

Related symptoms: across about 1000 generated exception-handling programs, 13 misbehave on Wizard main:

  • 11 throw a ClassCastException between value kinds (DF64→DI64, DI32→DI64, DV128→DI64, DI64→DF32);
  • 2 return a wrong value (presumably when the kinds happen to match).
Lingua principale
WebAssembly
Stelle
514
Fork
52
Merge medio
2h 58m
PR unite (30g)
16

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

  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 titzer/wizard-engine

Tutte le issue di titzer/wizard-engine

Issue simili

Altre issue su Compilers

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.