[LLVMbugs] [Bug 11612] New: _Atomic does not allow initialisation -- needed for ATOMIC_VAR_INIT()

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Dec 18 13:42:36 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=11612

             Bug #: 11612
           Summary: _Atomic does not allow initialisation -- needed for
                    ATOMIC_VAR_INIT()
           Product: clang
           Version: 3.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: ed at 80386.nl
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The latest C1X draft mentions a macro called ATOMIC_VAR_INIT() that can be used
to initialize an atomic variable.

_Atomic(int) i = ATOMIC_VAR_INIT(3);

As an experiment, I implemented a C-centric version of <stdatomic.h> for
FreeBSD:

http://80386.nl/pub/stdatomic.txt

Now the question is: how should I implement ATOMIC_VAR_INIT()? It seems like
assigning values to these variables directly doesn't work:

error: initializing '_Atomic(int)' with an expression of incompatible type
'int';
_Atomic(int) x = 3;
             ^   ~

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list