EXC_BAD_ACCESS when trying to build as a standalone plugin

template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _Tp __cxx_atomic_load(__cxx_atomic_base_impl<_Tp> const* __a, memory_order __order) _NOEXCEPT {
  using __ptr_type = __remove_const_t<decltype(__a->__a_value)>*;
  return __c11_atomic_load(
      const_cast<__ptr_type>(std::addressof(__a->__a_value)), static_cast<__memory_order_underlying_t>(__order));

“c11_atomic_code” is the underlined bit.

This error just popped out of nowhere, not sure what caused it. Prior to that I had just fixed the error caused by not adding the versionHint for some parameters, but I don’t know if that’s relevant here. Will gladly provide any additional info.

My guess is that the actual error happens earlier (e.g. nullptr or dangling pointer dereference) and this is just the first point at which the program attempts to read from an invalid address.

You could try enabling Address Sanitizer (there’s an option in the Edit Scheme dialog in Xcode, or you can pass the compile-time flag -fsanitize=address). This will print detailed diagnostic information on any invalid memory access, which should help you to work out what’s causing the problem.


Turned on Address Sanitizer and got this. Not sure where to go from here :sweat_smile:

In the console output window, there should be some stack trace information that shows where the memory was allocated and freed.


Is this right?

Double-check and then re-double-check the initializer code for your Parameters - its possible you’ve put the Parameter VersionHint in the wrong place …

That’s not what I was expecting. When Address Sanitizer is enabled, how does the call-stack view (left side of the screen) look at the point of the crash?

What’s “getChainSettings”? It looks like something’s going wrong in there.

I’ll take a shot in the dark here: you’re trying to read a raw parameter value (pointer to atomic float), but either you forgot to retrieve the pointer, or you made a typo in the parameter ID.

Never do this:

std::atomic<float>* myParameter = apvts.getRawParameterValue("MY_PRAMTER");

without this:

jassert(myParameter);

An even better (additional) line of defense: put all your ID strings as constants in something like an “Identifiers.h” and only use those constants in your code.

2 Likes


Did you double-check your parameter ID strings as @hugoderwolf suggested?