Debugging the following program #include <atomic> enum class foo {ONE, TWO, THREE, FOUR, FIVE, SIX}; int main(int argc, char **argv) { std::atomic<foo> x = foo::FOUR; std::atomic<int> y = int(foo::FOUR); foo z = foo::FOUR; return 0; } (after compilation with gcc version 8.3.1 20190223 (Red Hat 8.3.1-2) (GCC)) in gdb GNU gdb (GDB) Fedora 8.2-6.fc29: (gdb) break main Breakpoint 1 at 0x401111: file atest.cpp, line 7. (gdb) r Starting program: /home/uvb/Programming/CPPProjects/atest warning: Loadable section ".note.gnu.property" outside of ELF segments warning: Loadable section ".note.gnu.property" outside of ELF segments warning: Loadable section ".note.gnu.property" outside of ELF segments Breakpoint 1, main (argc=1, argv=0x7fffffffd6b8) at atest.cpp:7 7 std::atomic<foo> x = foo::FOUR; (gdb) p z $1 = foo::ONE (gdb) p y $2 = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = 32767}, static is_always_lock_free = true} (gdb) p x $3 = {static _S_min_alignment = 4, static _S_alignment = 4, _M_i = foo::ONE, Segmentation fault (core dumped) As can be seen, the enum can be printed, the atomic<int> can be printed, but attempting to print atomic<enum> causes gdb to segfault.
Dup. *** This bug has been marked as a duplicate of bug 20020 ***