develooper Front page | perl.perl5.porters | Postings from June 2013

Integer Undefined Behavior Detection using Clang 3.3

Thread Next
From:
Steffen Mueller
Date:
June 25, 2013 06:42
Subject:
Integer Undefined Behavior Detection using Clang 3.3
Message ID:
51C93BC7.8080702@cpan.org
This might be of interest to some. Not all things detected make me worry 
too much, but there's at least a few interesting bits.

http://blog.regehr.org/archives/963

For example, we have this in S_uiv_2buf:

	uv = -iv;

using the obvious types. According to the above tool, this could trigger 
undefined behaviour (perl 5.18 code):

sv.c:2710:7: runtime error: negation of -9223372036854775808 cannot be 
represented in type 'IV' (aka 'long'); cast to an unsigned type to 
negate this value to itself

--Steffen

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About