About stdatomic:
In lib/stdatomic.c, I found that the atomic_load/atomic_store :
#define ATOMIC_LOAD(TYPE, MODE) \    TYPE __atomic_load_##MODE(const volatile 
void *atom, int memorder) \    { \        return *(volatile TYPE *)atom; \    }
#define ATOMIC_STORE(TYPE, MODE) \    void __atomic_store_##MODE(volatile void 
*atom, TYPE value, int memorder) \    { \        *(volatile TYPE *)atom = 
value; \    }

I think it is better to ensure atomic_load get latest value, as follow:
#define ATOMIC_LOAD(TYPE, MODE) \    TYPE __atomic_load_##MODE(const volatile 
void *atom, int memorder) \    { \        
__atomic_thread_fence(__ATOMIC_ACQUIRE); \        return *(volatile TYPE 
*)atom; \    }
#define ATOMIC_STORE(TYPE, MODE) \    void __atomic_store_##MODE(volatile void 
*atom, TYPE value, int memorder) \    { \        *(volatile TYPE *)atom = 
value; \        __atomic_thread_fence(__ATOMIC_RELEASE); \    }
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to