This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Let fold_rtx's unsigned_fix be consistent with other cases


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]