[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making 'eq' == 'eql' in bignum branch

From: Paul Eggert
Subject: Re: Making 'eq' == 'eql' in bignum branch
Date: Wed, 22 Aug 2018 06:55:30 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

Herring, Davis wrote:
this is far from the only place in Emacs where what is formally undefined behavior is 
expected to "do the obvious thing"

Emacs does not rely on undefined behavior for integer arithmetic. Even in Emacs 26, (abs most-negative-fixnum) yields most-negative-fixnum without doing anything undefined at the C level, because (- most-negative-fixnum) fits within machine limits and the tagging operation does not overflow.

Although there may be a few places left in Emacs that rely on undefined integer behavior, these are now considered bugs and occasionally I try to stamp them out by building with gcc -fsanitize=undefined. For example, in Emacs 26 (* most-positive-fixnum most-positive-fixnum) returns 1 (the overflowed value) without overflowing at the C level.

Emacs *does* rely on undefined behavior when it tags pointers, but that's a different kettle of fish.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]