[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [csmith-dev] mission drift proposal #2 -- C++0x memory model



I think we can also definitely test C concurrency. C lacks atomics but the rest is not too different.

The problem is that since C has no memory model, I'm not sure what to test.

John




On 06/09/2011 03:01 PM, Chucky Ellison wrote:
I don't know anything about C++, so I don't know how similar the constructs
are, but it would be great if what you generated could be used for C as
well.  C1X has atomics with different kinds of memory ordering constraints,
and of course threads with locks and mutexes.

-Chucky

On Thu, Jun 9, 2011 at 3:34 PM, John Regehr <regehr@cs.utah.edu
<mailto:regehr@cs.utah.edu>> wrote:

    It looks like some compilers (for example GCC) are not too far from
    being ready to try to comply with the C++0x memory model.  This will be
    a big job and they do not yet fully understand how this model will
    interact with their optimizer.  It's fair to say that most other C++
    compilers will be running into similar issues in coming years.  We can
    help by adding C++0x memory model constructs to the set of things
    Csmith can emit.

    Note that I'm not suggesting that we emit "interesting" C++, which is a
    very big job.  Rather, we can emit C++ that looks very much like C but
    that contains locks, atomics, volatiles, etc.  I can't imagine there's
    anything difficult about this, given the infrastructure we already have.

    Hans Boehm has an excellent slide deck on what can go wrong when
    compiling this sort of code:

    http://www.hpl.hp.com/personal/Hans_Boehm/misc_slides/c++mm.pdf

    The problem of determining the correctness of a compiler's translation
    of a piece of code containing C++0x concurrency primitives is not
    trivial, but basically it's not our problem.  There exist (or will
    exist) some smart checking tools for this sort of thing.

    John