Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8194287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:46:20+00:00 2026-06-07T04:46:20+00:00

While looking at Clang and g++ C++11 implementation status I noticed something strange: they

  • 0

While looking at Clang and g++ C++11 implementation status I noticed something strange:
they support C++11 atomics, but they dont support C++11 memory model.
I was under impression that you must have C++11 memory model to use atomics.
So what exactly is the difference between support for atomics and memory model?
Does a lack of memory model support means that legal C++11 programs that use std::atomic<T> arent seq consistent?

references:
http://clang.llvm.org/cxx_status.html
http://gcc.gnu.org/gcc-4.7/cxx0x_status.html

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T04:46:21+00:00Added an answer on June 7, 2026 at 4:46 am

    One of the issues is the definition of “memory location”, that allows (and forces the compiler to support) locking different structure members by different locks. There is a discussion about a RL problem caused by this.

    Basically the issue is that having a struct defined like this:

    struct x {
        long a;
        unsigned int b1;
        unsigned int b2:1;
    };
    

    the compiler is free to implement writing to b2 by overwriting b1 too (and apparently, judging from the report, it does). Therefore, the two fields have to be locked as one. However, as a consequence of the C++11 memory model, this is forbidden (well, not really forbidden, but the compiler must ensure simultaneous updates to b1 and b2 do not interfere; it could do it by locking or CAS-ing each such update, well, life is difficult on some architectures). Quoting from the report:

    I’ve raised the issue with our GCC guys and they said to me that: “C does
    not provide such guarantee, nor can you reliably lock different
    structure fields with different locks if they share naturally aligned
    word-size memory regions. The C++11 memory model would guarantee this,
    but that’s not implemented nor do you build the kernel with a C++11
    compiler.”

    Nice info can also be found in the wiki.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background: Recently while looking at a structured text editor I noticed they used a
I just noticed a strange behaviour while looking at my application in the Flash
While looking for something totally different the other day, I have stumbled upon two
While looking through a 3rd party JavaScript API and example code I noticed the
I've started looking over the reactive framework. Very nice stuff. But while looking at
While looking into some webGL examples (mostly Three.js based examples) I noticed large models
While looking through the Spring MVC framework I noticed that, unless I misunderstand, its
While looking through the log4j documentation I noticed that a database could be a
While looking through the built in Android themes/styles I noticed references to textColorPrimary, textColorSecondary
While looking over various PHP libraries I've noticed that a lot of people choose

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.