[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Having fun with the following C code (UB)



On 2014-04-14 13:11:12 +0200, Jakub Wilk wrote:
> * Vincent Lefevre <vincent@vinc17.net>, 2014-04-14, 12:56:
> >IMHO, in general, for security, it is better to run code with a sanitizer
> >(such as "clang -fsanitize=undefined -fno-sanitize-recover", assuming that
> >the code does not use floating point),
> 
> gcc has also -ftrapv, which might be what you want.

But it it just supports +, - and *, and has various bugs and
limitations:

  http://gcc.gnu.org/bugzilla/buglist.cgi?quicksearch=trapv&list_id=87725

clang's sanitizer covers much more operations.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


Reply to: