[13621] in Athena Bugs
Re: NASTY C compiler bug gnu locker gcc AND 95q2.
daemon@ATHENA.MIT.EDU (John Carr)
Thu Jun 29 20:05:06 1995
To: Bill Cattey <wdc@MIT.EDU>
Cc: bugs@MIT.EDU, gnu@MIT.EDU, reidmp@MIT.EDU, watchmakers@MIT.EDU,
developers@MIT.EDU, yoav@MIT.EDU, tjm@MIT.EDU, proven@MIT.EDU
In-Reply-To: Your message of "Thu, 29 Jun 1995 19:14:06 EDT."
<QjwnCyYGgE47QFuYAo@mit.edu>
Date: Thu, 29 Jun 1995 20:04:53 EDT
From: John Carr <jfc@MIT.EDU>
You included two copies of the new gcc file rather than a copy of new and
a copy of old, but I think I know what is happening.
Recent versions of gcc will optimize divide by constant to a multiply by
the reciprocal. The multiply is supposed to be 32x32 -> 64 bits (you
really multiply by the reciprocal x 2^32). In the code you sent gcc is
only doing a 32 bit multiply (inlined as shifts and adds).
You can probably work around the bug by specifying the -mv8 argument to
gcc. With this flag gcc targets version 8 SPARC processors (i.e. anything
newer than an IPX). Version 8 has hardware multiply and divide. You
should use this flag anyway if most targeted machines are v8 (as they are
at athena). The code will still run on older processors; the OS will
emulate the instructions.