[cfe-commits] [PATCH] fix shifts that are defined in OpenCL but not in C99, etc

Richard Smith richard at metafoo.co.uk
Mon Jan 7 14:17:26 PST 2013


On Mon, Jan 7, 2013 at 3:52 AM, David Tweed <David.Tweed at arm.com> wrote:
> Hi, thanks for the review. I'll make the changes requested. With respect to
>
> | Presumably, -fsanitize=shift should be disabled for OpenCL. It's
> | included in -fsanitize=undefined, which should only catch undefined
> | behavior.
>
> I think the spirit is right. However, what I'll do is add an && !langOpts.OpenCL() to places where langOpts.SanitizeShift is used because
>
> (a) Being certain of definedness of arithmetic ops is pretty tricky (IMO). It's not obvious to me whether every possibility is well-defined in OpenCL (v 1.2), so it's not clear if there are cases in OpenCL one would still want to sanitize, so I don't want to switch the whole thing off in the driver options when using OpenCL.
>
> (b) Putting it nearby in the code makes it clearer this checking isn't done in OpenCL, so it'll be respected when stuff gets refactored.
>
> I'll respin the patch and then commit.

Thanks, that's actually what I had meant anyway, and matches what we
do for C (where the UB rules are slightly different) :-)




More information about the cfe-commits mailing list