mats petersson via llvm-dev
2015-Sep-15 08:56 UTC
[llvm-dev] Dynamic detection of signed integer overflow
On 15 September 2015 at 09:48, John Regehr via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Thanks John, seems like a dynamic runtime instrumentation is then not a >> good idea. I had a look at the UBSan features in Clang and I might be able >> to use them instead. But it seems like that vector operations are not >> instrumented with overflow checks if I specify the option >> -fsanitize=signed-integer-overflow. Am I missing some other option or is >> there a special reason why vector operations are not checked? >> > > I might be misunderstanding you, and I haven't looked at this code lately, > but the goal of UBSan is to check C's rules for integer UBs. Since C does > not have vectors, I'm not sure exactly what you are expecting here. Could > you give a bit more detail?OpenCL as a language is a modified C99, which does have, amongst a few other things, support for vector types for basic types (char, short, int, long and their unsigned variants as well as floating point types half, float and double). So, there is probably some work required to implement this for OpenCL's native vector support. I haven't looked at the code, so can't say if there's any particular difficulty in this particular case. -- Mats> > > John > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150915/a4dcadfb/attachment.html>
Pflanzer, Moritz via llvm-dev
2015-Sep-15 09:12 UTC
[llvm-dev] Dynamic detection of signed integer overflow
> I might be misunderstanding you, and I haven't looked at this code lately, but the goal of UBSan is to check C's rules for integer UBs. Since C does not have vectors, I'm not sure exactly what you are expecting here. Could you give a bit more detail?I just wondered whether the checks might have been implemented for vector types as well since Clang features vector extensions for the C language.>> OpenCL as a language is a modified C99, which does have, amongst a few other things, support for vector types for basic types (char, short, int, long and their unsigned variants as well as floating point types half, float and double). >> >> So, there is probably some work required to implement this for OpenCL's native vector support. I haven't looked at the code, so can't say if there's any particular difficulty in this particular case.I will have a look then. In general, is there any interest to lift the UBSan implementation to include checks for vector types, even if they are not part of the C language? Thanks, Moritz
John Regehr via llvm-dev
2015-Sep-15 09:17 UTC
[llvm-dev] Dynamic detection of signed integer overflow
> I just wondered whether the checks might have been implemented for vector types as well since Clang features vector extensions for the C language.Ah, no, I don't believe so. And making these checks efficient might be challenging. Adding them sounds useful to whatever extent the vector users care about overflows (I hope they care...). John