jart/blink

error: address argument to atomic operation must be a pointer to non-const _Atomic type

ryandesign opened this issue · 0 comments

blink 1.0.0 fails to build on older versions of macOS using older versions of Apple Clang (older than 1001):

./blink/jit.h:270:10: error: address argument to atomic operation must be a pointer to non-const _Atomic type ('const _Atomic(bool) *' invalid)
  return atomic_load_explicit(&jit->disabled, memory_order_acquire);
         ^                    ~~~~~~~~~~~~~~

I reported this to MacPorts as well.

There's more background in a similar PHP bug report.

It seems that C11 defined this to be non-const, and C17 fixed it to be const, and Apple Clang 1001 and later will also allow it to be const even in C11 mode.

Your README says you support C11 compilers:

- A C11 compiler with atomics (e.g. GCC 4.9.4+)

My suggested solutions are that you either cast away the constness so that you are actually compatible with all C11 compilers, or you indicate that you require a C17 compiler.