autoconf
[Top][All Lists]
Advanced

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

Re: Why is malloc being defined as rpl_malloc ??


From: Dr. David Kirkby
Subject: Re: Why is malloc being defined as rpl_malloc ??
Date: Tue, 06 May 2003 00:54:23 +0100

Paul Eggert wrote:

> But the Alpha uses IEEE-754 arithmetic.  It's only the older designs
> (IBM and Unisys mainframes, VAX, Crays) that lack IEEE.

I've put below inside rows of xxxxx's, a copy of an email from someone
who found a bug in my 'atlc' program on his Dec Alpha, and HIS reasons
for why he found the bug on the Dec Alpha, which I had never been
detected on a Sun or PC.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
"The real reason I found
the bugs is because the DEC alpha does not implement full IEEE 754
math
in hardware.  For full compliance, you need a software assist.  This
comes
in the form of some operating system hooks and some stuff the compiler
has
to provide.  On the compiler end its the -mieee flag to gcc.  If you
don't
provide this flag, you'll get a floating point exception and a crash
of
the program if the program does things like divide by zero or related
things.  I've come across a good bit of software which doesn't
initialize
some variable properly the first time through a loop and produces this
behaviour on an alpha.  I've actually taken to leaving off the -mieee
on
my alpha to help locate such bugs which can cause other unpredictable
behaviour."
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

You say the Alpha implements IEE-754, but don't say whether you mean
in hardware or software. 

The above email, coupled with another from someone else about another
issue related to a Dec Alpha, was enough to convince me that testing
code on a Dec Alpha was a sensible thing to do, as the combination of
the Tru64/wordsize/endianness/IEEE standard ... meant that it was a
more useful test bed than putting X's distribution of GNU/Linux on a
PC. This issue with malloc (my reason for originally posting) just
adds to the list of things that seem to break on a Dec Alpha, but not
on the Sun or PC platforms, that I personally have more experience
with. 
 
> > My attitude is that if I can produce code that produces
> > 'sensible/useful' results on hardware not conforming to that standard,
> > without sacrificing performance on IEEE-754 machines, I will do so.
> 
> Hmm, even if the code is noticeably harder to maintain?  You'd do that
> just for IBM mainframes and Crays?  I'm not sure I'd bother, myself.

I wont go out of my way to make major changes to circumvent problems
in non-IEEE machines, but if it means that I properly initilise a
variable, rather than leave it un-initialised (as was the case with
the bug this person found on his Dec Alpha), then I will try to fix
the problem. In this case an error that was ignored by gcc -Wall and
that never showed its ugly head on my Sun's or PC's, was found on the
Dec Alpha. The issue about malloc was again only found on a Dec Alpha. 


-- 
Dr. David Kirkby,
Senior Research Fellow,
Department of Medical Physics,
University College London,
11-20 Capper St, London, WC1E 6JA.
Tel: 020 7679 6408 Fax: 020 7679 6269
Internal telephone: ext 46408
e-mail address@hidden




reply via email to

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