|
|
Message-ID: <20150727191124.O976O.29152.imail@eastrmwml302>
Date: Mon, 27 Jul 2015 19:11:24 -0400
From: <jfoug@....net>
To: john-dev@...ts.openwall.com
Subject: Re: Ambiguous pointer increments
---- magnum <john.magnum@...hmail.com> wrote:
> The beignet OpenCL driver complained about oldoffice kernel, "multiple
> unsequenced modifications to 'p'" for things like the below:
>
> - for (i = 0; i < 32; i += 2)
> - W[i >> 1] = (uint)*p++ | (*p++ << 16U);
>
> I already changed it but I'm curious - no other driver complained.
>
> + for (i = 0; i < 32; i += 2) {
> + W[i >> 1] = (uint)*p++;
> + W[i >> 1] |= (*p++ << 16U);
> + }
>
> Originally I thought they (the use/increments of p) were guaranteed to
> be left-to-right but after this I'm not sure at all. Anyone know for
> sure? Alexander Cherepanov perhaps? In case it matters, OpenCL is C99.
That is 100% undefined code, for sure. One of the only times you can do more than 1 increment in a statement is in the tertiary statement.
Here it the 'classic' undefined. i = i++;
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.