public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jwakely dot gcc at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/40297] New: [C++0x] debug mode vs atomics Date: Fri, 29 May 2009 17:38:00 -0000 [thread overview] Message-ID: <bug-40297-5876@http.gcc.gnu.org/bugzilla/> (raw) The atomic types in <cstdatomic> have debug-mode assertions that will always fail. #define _GLIBCXX_DEBUG #include <cstdatomic> int main() { std::atomic_address ptr; return ptr.load() ? 0 : 1; } Fails with: /dev/shm/wakelyjo/insroot/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../include/c++/4.5.0/bits/atomic_2.h:114: void* std::__atomic2::atomic_address::load(std::memory_order) const volatile: Assertion '__m == memory_order_release' failed. Due to: void* load(memory_order __m = memory_order_seq_cst) const volatile { __glibcxx_assert(__m == memory_order_release); __glibcxx_assert(__m == memory_order_acq_rel); __sync_synchronize(); void* __ret = _M_i; __sync_synchronize(); return __ret; } Since memory_order is an enumeration and each enumerator has a distinct value, it's not possible for both assertions to pass. I'm not sure what they were intended to check, unless it's to prevent atomics being used in debug mode! -- Summary: [C++0x] debug mode vs atomics Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jwakely dot gcc at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40297
next reply other threads:[~2009-05-29 17:38 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2009-05-29 17:38 jwakely dot gcc at gmail dot com [this message] 2009-06-04 15:16 ` [Bug libstdc++/40297] " paolo dot carlini at oracle dot com 2009-06-16 12:35 ` jwakely dot gcc at gmail dot com 2009-06-18 0:33 ` bkoz at gcc dot gnu dot org 2009-06-18 12:43 ` jwakely dot gcc at gmail dot com 2009-06-18 12:48 ` redi at gcc dot gnu dot org 2009-06-24 7:06 ` redi at gcc dot gnu dot org 2009-06-24 7:08 ` redi at gcc dot gnu dot org 2009-06-24 7:09 ` jwakely dot gcc at gmail dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-40297-5876@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).