Web49 icon indicating copy to clipboard operation
Web49 copied to clipboard

'isnanf' is invalid in C99

Open konsumer opened this issue 2 years ago • 2 comments

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 avatar Jan 25 '23 20:01 konsumer

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

konsumer avatar Jan 25 '23 20:01 konsumer

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

ShawSumma avatar May 07 '23 11:05 ShawSumma