r185035 - PR16467: Teach -Wunsequenced that in C11 (unlike C++11), an assignment's

Richard Smith richard at metafoo.co.uk
Sun Jun 30 03:42:30 PDT 2013


On Sat, Jun 29, 2013 at 4:48 PM, Dimitry Andric <dimitry at andric.com> wrote:
> On Jun 27, 2013, at 01:16, Richard Smith <richard-llvm at metafoo.co.uk> wrote:
>> Author: rsmith
>> Date: Wed Jun 26 18:16:51 2013
>> New Revision: 185035
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=185035&view=rev
>> Log:
>> PR16467: Teach -Wunsequenced that in C11 (unlike C++11), an assignment's
>> side-effect is not sequenced before its value computation. Also fix a
>> mishandling of ?: expressions where the condition is constant that was
>> exposed by the tests for this.
>
>
> Hi Richard,
>
> After this commit, the -Wunsequenced warning seems to have gotten a little too aggressive.  It now also warns about the following (admittedly silly) construction:
>
> char *foo(char *p);
>
> void bar(char *p)
> {
>   p = foo(++p);
> }
>
> // unseq.c:5:11: warning: multiple unsequenced modifications to 'p' [-Wunsequenced]
> //   p = foo(++p);
> //     ~     ^
>
> Since a function call is a sequence point, the warning is not warranted in its current form.
>
> Shall I re-open PR16467, or create a new PR?

Neither, I fixed this in r185282. Thanks for reporting it!



More information about the cfe-commits mailing list