<div dir="ltr">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.</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jan 20, 2014 at 6:28 AM, miroslav.fontan <span dir="ltr"><<a href="mailto:miroslav.fontan@wincor-nixdorf.cz" target="_blank">miroslav.fontan@wincor-nixdorf.cz</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I would like to ask whether it is possible to turn an integer sanitizer to<br>
capture integer overflows in an assignment statement<br>
<br>
int32_t i32 = INT32_MAX;<br>
int16_t i16 = i32; // runtime warning "integer assignment overflow" would be<br>
fine<br>
<br>
I know there is a flag -Wconversion and the code should compile cleanly with<br>
-Wconversion -Werror. At this point it is impossible to clean the entire<br>
code base, I need to first find the most critical parts and to start<br>
cleaning the code from there<br>
<br>
Regards<br>
---<br>
Mira<br>
<br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div>