[PATCH] Sema: reject probably incorrect atomic ordering requests

JF Bastien jfb at google.com
Mon Mar 10 21:59:24 PDT 2014


lgtm after adding tests of missing __c11_atomic_* to test/Sema/atomic-ops.c,
especially load_n/store_n.


On Mon, Mar 10, 2014 at 8:48 AM, Tim Northover <t.p.northover at gmail.com>wrote:

> Hi all,
>
> The builtin atomic operations (up to now) have been a little unfriendly in
> simply not emitting anything if an invalid memory ordering is requested
> (e.g. "__c11_atomic_load(p, memory_order_release)").
>
> This patch adds some Sema checking (to an error) if the operand is an
> integer-constant-expression and not permitted. It'll obviously still miss
> cases (since we apparently support non-constant arguments there), but
> hopefully it's an improvement to the current situation.
>
> Does it look reasonable? My Clang is rather rusty.
>
> Cheers.
>
> Tim
>
> http://llvm-reviews.chandlerc.com/D3027
>
> Files:
>   include/clang/AST/Expr.h
>   include/clang/Basic/DiagnosticSemaKinds.td
>   lib/CodeGen/CGAtomic.cpp
>   lib/Sema/SemaChecking.cpp
>   test/CodeGen/atomic-ops.c
>   test/CodeGen/big-atomic-ops.c
>   test/Sema/atomic-ops.c
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140310/e8753429/attachment.html>


More information about the cfe-commits mailing list