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

Re: Integer Undefined Behavior Detection using Clang 3.3

Thread Previous
From:
Zefram
Date:
July 28, 2013 12:48
Subject:
Re: Integer Undefined Behavior Detection using Clang 3.3
Message ID:
20130728124835.GE11327@fysh.org
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.)

-zefram

Thread Previous


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