[cfe-dev] A need for an "-fsanitize=integer-assign-overflow"

miroslav.fontan miroslav.fontan at wincor-nixdorf.cz
Mon Jan 20 15:02:20 PST 2014

I looked into the code and I think it's a missing feature. The question is
whether it is worth implementing.


From: David Blaikie [mailto:dblaikie at gmail.com] 
Sent: Monday, January 20, 2014 7:37 PM
To: miroslav.fontan; Richard Smith
Cc: cfe-dev Developers
Subject: Re: [cfe-dev] A need for an "-fsanitize=integer-assign-overflow"


In theory something like UBSan (-fsanitize=undefined) or the Integer
sanitizer (-fsanitize=integer) should help catch this at runtime, but I
can't seem to get them to fire on this code. Not sure if it's a missing
feature/bug or some necessary false negative.


On Mon, Jan 20, 2014 at 6:28 AM, miroslav.fontan
<miroslav.fontan at wincor-nixdorf.cz> wrote:

Hi all,

I would like to ask whether it is possible to turn an integer sanitizer to
capture integer overflows in an assignment statement

int32_t i32 = INT32_MAX;
int16_t i16 = i32; // runtime warning "integer assignment overflow" would be

I know there is a flag -Wconversion and the code should compile cleanly with
-Wconversion -Werror. At this point it is impossible to clean the entire
code base, I need to first find the most critical parts and to start
cleaning the code from there


cfe-dev mailing list
cfe-dev at cs.uiuc.edu


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140121/0a8b1b67/attachment.html>

More information about the cfe-dev mailing list