Your message dated Wed, 30 Mar 2016 14:08:58 +0200
with message-id
<ca+7wuswjba0owu3n8wfkpqerxe+54sg1z0nqfz_ia3ve02z...@mail.gmail.com>
and subject line
has caused the Debian Bug report #769959,
regarding fhist: FTBFS on arm64, probably because of signed overflow
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
769959: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=769959
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Source: fhist
Version: 1.18-1
It failed to build on arm64:
http://buildd.debian.org/status/package.php?p=fhist&suite=sid
The error was:
/bin/sh test/00/t0001a.sh
Segmentation fault
FAILED test of basic fcomp functionality
This seems to be an example of a kind of bug that has become quite
fashionable recently: the programmer does something that gives
undefined behaviour according to the C standard but which has always
worked in the past, but now a modern optimising compiler spots the
potentially undefined behaviour and optimises the code on the
(perfectly justifiable) assumption that the undefined behaviour won't
happen at run time.
In this case we have in common/compare.c:
char *curcp;
long hash = 0;
for (curcp = canon; *curcp; curcp++)
{
ch = *curcp;
hash += ((hash * 101) + ch);
if (hash < 0)
hash = (hash + 1) & INFINITY;
}
A hash is being computed in a way that depends on signed overflow.
That's obvious to the human reader, but the compiler says to itself:
Signed overflow is illegal - everyone knows that - so the programmer
must have done something to make sure it won't happen: presumably we
only ever go round the loop a small number of times. In any case, hash
can never be negative so we can remove the "if" statement.
But then at run time signed overflow does happen, hash goes negative,
and the segfault happens a few lines later.
The reason this happens on arm64 in particular is that char is
unsigned here.
A really bad way to make the package build on arm64 is to insert this
line just before the "if" statement:
hash = *(volatile long *)&hash;
Don't do that, of course. Instead, make "hash" unsigned.
I note this package is rather old in Debian. However, the same bug
seems to be there in upstream's 1.21.
--- End Message ---
--- Begin Message ---
Control: fixed -1 1.18-2
--- End Message ---