This is the mail archive of the 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]

forgotten aclocal.m4 tweak

I found this while going through some old trees.  It fixes the test
for the number of bits in a byte so that it actually works.  No one's
noticed because no one's been running with a machine with (a) no
CHAR_BIT in limits.h and (b) more than 8 bits in a byte.

In case anyone is wondering, the problem was that the test program
compiled successfully if $i was *less than* or equal to the number of
bits in a byte.  You'd never notice on an 8-bit machine because the
loop starts with i=8 (C89 minimum).  And this test isn't even run if
limits.h has CHAR_BIT.

Applied to mainline as obvious bugfix.


	* aclocal.m4 (gcc_AC_C_CHAR_BIT): Correct test program.

Index: aclocal.m4
--- aclocal.m4	2001/03/16 23:57:46	1.46
+++ aclocal.m4	2001/05/01 17:34:22
@@ -1192,9 +1192,11 @@ if test $gcc_cv_decl_char_bit = no; then
  while test $i -lt 65; do
-   [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`
  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]