How about if we install the following coreutils patch?
It should catch the more-general problem, if I understand it aright.

My understanding is that the following little C program:

   #include <stdbool.h>
   #include <assert.h>
   int main (void) {
     assert (-1 - (_Bool) 0 < 0);
     assert (-1 - (bool) 0 < 0);
     return 0;
   }

will have an assertion failure with the buggy IBM compiler.
If it doesn't, we'd need to modify the stdbool.m4 part of this fix.


2005-10-06  Paul Eggert  <[EMAIL PROTECTED]>

        * m4/stdbool.m4 (AC_HEADER_STDBOOL): Check that bool
        promotes to int, not unsigned int, to catch the AIX 5.3
        compiler bug.
        * src/sort.c (sortlines_temp): Undo previous change, since
        the above should catch it.

Index: m4/stdbool.m4
===================================================================
RCS file: /fetish/cu/m4/stdbool.m4,v
retrieving revision 1.4
diff -p -u -r1.4 stdbool.m4
--- m4/stdbool.m4       22 Jan 2005 06:25:53 -0000      1.4
+++ m4/stdbool.m4       6 Oct 2005 08:02:20 -0000
@@ -1,6 +1,6 @@
 # Check for stdbool.h that conforms to C99.
 
-dnl Copyright (C) 2002-2004 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2005 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -70,10 +70,11 @@ AC_DEFUN([AC_HEADER_STDBOOL],
          enum { j = false, k = true, l = false * true, m = true * 256 };
          _Bool n[m];
          char o[sizeof n == m * sizeof n[0] ? 1 : -1];
+         char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
        ],
        [
          return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !j + !k + !l
-                 + !m + !n + !o);
+                 + !m + !n + !o + !p);
        ],
        [ac_cv_header_stdbool_h=yes],
        [ac_cv_header_stdbool_h=no])])
Index: src/sort.c
===================================================================
RCS file: /fetish/cu/src/sort.c,v
retrieving revision 1.326
diff -p -u -r1.326 sort.c
--- src/sort.c  5 Oct 2005 18:56:29 -0000       1.326
+++ src/sort.c  6 Oct 2005 08:02:21 -0000
@@ -1720,9 +1720,7 @@ sortlines_temp (struct line *lines, size
 {
   if (nlines == 2)
     {
-      /* Declare `swap' as int, not bool, to work around a bug in
-        an AIX 5.3 compiler in 64-bit mode.  */
-      int swap = (0 < compare (&lines[-1], &lines[-2]));
+      bool swap = (0 < compare (&lines[-1], &lines[-2]));
       temp[-1] = lines[-1 - swap];
       temp[-2] = lines[-2 + swap];
     }


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to