This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
undefined behavior if sizeof(mp_limb_t)>sizeof(long)
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: 10 Mar 2003 12:49:42 -0300
- Subject: undefined behavior if sizeof(mp_limb_t)>sizeof(long)
- Organization: GCC Team, Red Hat
This is one I had missed in the mips64-linux port I posted two months
ago, still awaiting review. Is there any interest in my extracting
the similar bits from that patch and submitting them separately?
Index: ChangeLog
from Alexandre Oliva <aoliva at redhat dot com>
* sysdeps/ieee754/dbl-64/dbl2mpn.c (__mpn_extract_double): Cast
implicit one to mp_limb_t before shifting it.
Index: sysdeps/ieee754/dbl-64/dbl2mpn.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/ieee754/dbl-64/dbl2mpn.c,v
retrieving revision 1.2
diff -u -p -r1.2 dbl2mpn.c
--- sysdeps/ieee754/dbl-64/dbl2mpn.c 6 Jul 2001 04:55:54 -0000 1.2
+++ sysdeps/ieee754/dbl-64/dbl2mpn.c 10 Mar 2003 15:46:06 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1994, 1995, 1996, 1997, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -101,7 +101,8 @@ __mpn_extract_double (mp_ptr res_ptr, mp
}
else
/* Add the implicit leading one bit for a normalized number. */
- res_ptr[N - 1] |= 1L << (DBL_MANT_DIG - 1 - ((N - 1) * BITS_PER_MP_LIMB));
+ res_ptr[N - 1] |= (mp_limb_t) 1 << (DBL_MANT_DIG - 1
+ - ((N - 1) * BITS_PER_MP_LIMB));
return N;
}
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva at {redhat dot com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva at {lsd dot ic dot unicamp dot br, gnu.org}
Free Software Evangelist Professional serial bug killer