[PATCH] Sema: reject probably incorrect atomic ordering requests

Richard Smith richard at metafoo.co.uk
Tue Mar 11 13:07:47 PDT 2014


Per C11 7.1.4/1, providing an invalid value for a library function argument
results in undefined behavior, and it's generally accepted that we can only
reject a program that has undefined behavior if the undefined behavior is
guaranteed to occur (either because it occurs during translation or because
it occurs on every execution of the program). So an error is not allowed
here, but a warning is fine.


On Tue, Mar 11, 2014 at 12:38 PM, JF Bastien <jfb at google.com> wrote:

> Isn't that the case with any errors that can crop up in control-flow
> sensitive manners, through template magic or tautological compares and
> such? I assume David has a better informed opinion on this than I do.
>
>
> On Tue, Mar 11, 2014 at 12:21 PM, Tim Northover <t.p.northover at gmail.com>wrote:
>
>> Hi JF,
>>
>> Thanks for taking a look.
>>
>> On 11 March 2014 04:59, JF Bastien <jfb at google.com> wrote:
>> > lgtm after adding tests of missing __c11_atomic_* to
>> test/Sema/atomic-ops.c,
>> > especially load_n/store_n.
>>
>> I committed it with a full set of tests (r203561), and then changed it
>> to a warning (r203564) when I realised valid programs could contain
>> statements like:
>>
>> if (0) {
>>   __c11_atomic_load(ptr, memory_order_release);
>> }
>>
>> or possibly even some sane equivalent via templates or other weirdness.
>>
>> Cheers.
>>
>> Tim.
>>
>
>
> _______________________________________________
> 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/20140311/a21e4464/attachment.html>


More information about the cfe-commits mailing list