https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92597

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
And the short examples do exactly what the original source does:
//taken from google benchmark
template <class Tp>
inline void DoNotOptimize(Tp const& value) {
  asm volatile("" : : "r,m"(value) : "memory");
}

template <class Tp>
inline void DoNotOptimize(Tp& value) {
#if defined(__clang__)
  asm volatile("" : "+r,m"(value) : : "memory");
#else
  asm volatile("" : "+m,r"(value) : : "memory");
#endif
}

Reply via email to