Segfault in std :: atomic load?

On linux, using gcc 4.8.4, compiled with -std = C ++ 11 -mcx16:

#include <atomic> struct node_t; struct pointer_t { node_t* ptr; unsigned int count; pointer_t() noexcept : ptr{nullptr}, count{0} {} }; struct empty {}; struct node_t { empty value; std::atomic<pointer_t> next; node_t() : next{pointer_t{}} {} }; int main() { node_t{}.next.load(); return 0; } 

gives segfault when calling load . How did I want to initialize the atomic value?

+7
c ++ segmentation-fault atomic c ++ 11
source share
1 answer

It turns out this is a bug in gcc, which has since been fixed in GCC 5.1. The indication of alignment for two words is fixed.

+8
source share

All Articles