FastVM / Web49

Web49: WebAssembly Interpeter
MIT License
322 stars 15 forks source link

'isnanf' is invalid in C99 #11

Open konsumer opened 1 year ago

konsumer commented 1 year ago

on mac 13.0.1 intel, if I run make or make CC=gcc

I get this error:

main/miniwasm.c:127:73: error: implicit declaration of function 'isnanf' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                                        if (data[n].f32 == expected || (isnanf(expected) && isnanf(data[n].f32))) {
                                                                        ^
1 error generated.
konsumer commented 1 year ago

If I replace isnanf with isnan it seems to build, so I can add this (hacky) macro to top:

#ifdef __APPLE__
#define isnanf(f) isnan(f)
#endif

Should I PR for this?

Update I am seeing this on benchmark, so this is maybe not the right way: memmory access 0xffffffff of size 0x4 out of bounds:

RUN: #1
  TEST: trap
    ENGINE: wasm3
Error: [trap] out of bounds memory access
Error: [trap] out of bounds memory access
Error: [trap] out of bounds memory access
Error: [trap] out of bounds memory access
Error: [trap] out of bounds memory access
Error: [trap] out of bounds memory access
Error: [trap] out of bounds memory access
Error: [trap] out of bounds memory access
Error: [trap] out of bounds memory access
Error: [trap] out of bounds memory access
    ENGINE: /Users/konsumer/Downloads/Web49-main/bin/miniwasm
memmory access 0xffffffff of size 0x4 out of bounds
memmory access 0xffffffff of size 0x4 out of bounds
memmory access 0xffffffff of size 0x4 out of bounds
memmory access 0xffffffff of size 0x4 out of bounds
memmory access 0xffffffff of size 0x4 out of bounds
memmory access 0xffffffff of size 0x4 out of bounds
memmory access 0xffffffff of size 0x4 out of bounds
memmory access 0xffffffff of size 0x4 out of bounds
memmory access 0xffffffff of size 0x4 out of bounds
memmory access 0xffffffff of size 0x4 out of bounds

It is only for wasm3, so maybe it's ok

ShawSumma commented 1 year ago

It is invalid c99 but so is ({}) and my whole goto strategy, clang understands it as the implementation language is settable -std=gnu11.