This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Let fold_rtx's unsigned_fix be consistent with other cases
- To: Geoff Keating <geoffk at geoffk dot org>
- Subject: Re: Let fold_rtx's unsigned_fix be consistent with other cases
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 20 Nov 2000 00:52:25 -0200
- Cc: gcc-patches at gcc dot gnu dot org
- Organization: GCC Team, Red Hat
- References: <ory9yg3nhs.fsf@guarana.lsd.ic.unicamp.br><jmn1ewg7nq.fsf@geoffk.org>
On Nov 18, 2000, Geoff Keating <geoffk@geoffk.org> wrote:
> I don't think this is very helpful. It will ensure that on machines
> where the hardware computes 0, that gcc's constant folding is
> consistently inconsistent with the hardware.
I wanted it to be consistent with:
#include <stdio.h>
int main()
static const unsigned char c = -9.0f;
printf ("%d\n", (int)c);
}
I couldn't find any platform in which GCC wouldn't emit something like
`.byte 247' as the value of `c'. Maybe I just haven't looked for it
hard enough...
In any case, the behavior is undefined, and, since the majority of the
platforms you surveyed have given the result as 247, my patch is an
improvement. Unfortunately, I don't have the time to arrange for it
to compute the ``right'' value right now, and I don't think it is that
important anyway, given that the behavior is undefined.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me