turbolent / w2c2

Translates WebAssembly modules to portable C
MIT License
712 stars 37 forks source link

SIGFPE (Floating point exception) #63

Closed Heath123 closed 1 year ago

Heath123 commented 1 year ago

Running w2c2 on this file:

(module
  (table $T0 1 1 funcref)
  (memory $memory 0)
  (global $g0 i32 (i32.const 8))
  (global $g1 (mut i32) (i32.const 16392))
  (global $g2 i32 (i32.const 16392))
  (export "memory" (memory 0))
  (elem $e0 (i32.const 1)))

gives me: fish: Job 1, 'w2c2 test.wasm test.c' terminated by signal SIGFPE (Floating point exception) It's happening here: https://github.com/turbolent/w2c2/blob/48efea52f7caa82b5a7616448a6c9d3085de6428/w2c2/c.c#L4808 I think it's a division by zero