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

Re: Integer Undefined Behavior Detection using Clang 3.3

Thread Previous
July 28, 2013 12:48
Re: Integer Undefined Behavior Detection using Clang 3.3
Message ID:
Steffen Mueller wrote:
>using the obvious types. According to the above tool, this could
>trigger undefined behaviour (perl 5.18 code):

The Perl core relies heavily on signed integer types being twos-complement
and on overflow wrapping.  The C standard doesn't guarantee the signed
representation or signed overflow behaviour, making them officially
undefined behaviour, but the behaviour we expect is in practice the
behavour on every platform we've gone anywhere near (even z/OS).
As there's no prospect of us ever reconciling the core to this part
of the C standard, a tool that points out some of the discrepancies
is of essentially no use.  (And while it'll pick up the cases that go
through proper type conversion, it won't pick up the many instances of
union-based reinterpretation of bit patterns.)


Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About