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]

Fix for "number of bits in a byte" detection


The "number of bits in a byte" autoconf probe doesn't work and appears
never to have worked.  No one noticed because everyone has <limits.h>
that defines CHAR_BIT, these days.

This patch corrects the problem.  The new test has been verified to do
the right thing on both 8-bit and 9-bit machines, and the configure
change + some other stuff (see separate message) bootstraps on
i686-linux.  OK to apply?

zw

	* aclocal.m4 (gcc_AC_C_CHAR_BIT): Replace the probe code with
	a test that actually works.
	* configure: Regenerate.

===================================================================
Index: aclocal.m4
--- aclocal.m4	2001/03/16 23:57:46	1.46
+++ aclocal.m4	2001/04/04 16:25:16
@@ -1192,9 +1192,11 @@ if test $gcc_cv_decl_char_bit = no; then
  gcc_cv_c_nbby=
  while test $i -lt 65; do
    AC_TRY_COMPILE(,
-   [switch(0) { case 0: case (char)(1 << $i) && (char)(1 << $i) != 1: ; }],
-         gcc_cv_c_nbby=$i
-         break)
+     [switch(0) {
+  case (unsigned char)((unsigned long)1 << $i) == ((unsigned long)1 << $i):
+  case (unsigned char)((unsigned long)1<<($i-1)) == ((unsigned long)1<<($i-1)):
+  ; }], 
+     [gcc_cv_c_nbby=$i; break])
    i=`expr $i + 1`
  done
  test -z "$gcc_cv_c_nbby" && gcc_cv_c_nbby=failed


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