Hi David,

This patch broke bootstrap on AIX again.  This is completely unacceptable.

Again, sorry for the breakage.

I faced quite some challenges trying to get bootstrap to
work on gcc119. Despite quite a few e-mails (plus hints in a PR)
that I received, none of the hints for bootstrap I got actually got
it to work. I finally gave up after four or five different failures,
and the patch was committed because every test
that _could_ be run did show no failure.

Had we received instructions that work for bootstrapping on AIX,
we would have tested the patch there.

If it were possible to add instructions that do work for AIX
bootstrapping to the compile farm wiki, that would be great.

If you (or somebody else who has the requisite AIX fu) could test
patches that are known to be difficult, that would also be
great.

As long as we have no other solution, it is probably best to #ifdef out
AIX any additional pthread-related functionality for libgfortran that
might be coming along. That can always be integrated later, if somebody
can re-implement POSIX condition variables for libgfortran from what
AIX provides.

Let's talk about how to proceed at the GNU cauldron, over a beer.
Both Nicolas and I will be there.

In the meantime, I have committed the following patch (r263788) as
obvious after regression-testing on Linux both with ASYNC_IO set
to 1 and to 0.  Let me know how that works out.

2018-08-22  Thomas Koenig  <tkoe...@gcc.gnu.org>

        * async.h: Set ASYNC_IO to zero if _AIX is defined.
        (struct adv_cond): If ASYNC_IO is zero, the struct has no members.
        (async_unit): If ASYNC_IO is zero, remove unneeded members.

2018-08-22  Thomas Koenig  <tkoe...@gcc.gnu.org>

        * gfortran.texi: Mention that asynchronous I/O does
        not work on systems which lack condition variables, such
        as AIX.

Regards

        Thomas
Index: gcc/fortran/gfortran.texi
===================================================================
--- gcc/fortran/gfortran.texi	(Revision 263752)
+++ gcc/fortran/gfortran.texi	(Arbeitskopie)
@@ -1509,7 +1509,8 @@
 
 Asynchronous I/O is supported if the program is linked against the
 POSIX thread library. If that is not the case, all I/O is performed
-as synchronous.
+as synchronous. On systems which do not support pthread condition
+variables, such as AIX, I/O is also performed as synchronous.
 
 On some systems, such as Darwin or Solaris, the POSIX thread library
 is always linked in, so asynchronous I/O is always performed. On other
Index: libgfortran/io/async.h
===================================================================
--- libgfortran/io/async.h	(Revision 263752)
+++ libgfortran/io/async.h	(Arbeitskopie)
@@ -29,7 +29,7 @@
    __gthread_cond_t and __gthread_equal / __gthread_self.  Check
    this.  */
 
-#if defined(__GTHREAD_HAS_COND) && defined(__GTHREADS_CXX0X)
+#if defined(__GTHREAD_HAS_COND) && defined(__GTHREADS_CXX0X) && !defined(_AIX)
 #define ASYNC_IO 1
 #else
 #define ASYNC_IO 0
@@ -328,21 +328,18 @@
 
 struct adv_cond
 {
+#if ASYNC_IO
   int pending;
   __gthread_mutex_t lock;
   __gthread_cond_t signal;
+#endif
 };
 
 typedef struct async_unit
 {
+  pthread_mutex_t io_lock;   /* Lock for doing actual I/O. */
   pthread_mutex_t lock;      /* Lock for manipulating the queue structure.  */
-  pthread_mutex_t io_lock;   /* Lock for doing actual I/O. */
-  struct adv_cond work;
-  struct adv_cond emptysignal;
-  struct st_parameter_dt *pdt;
-  pthread_t thread;
-  struct transfer_queue *head;
-  struct transfer_queue *tail;
+  bool empty;
   struct
   {
     int waiting;
@@ -351,7 +348,13 @@
     struct adv_cond done;
   } id;
 
-  bool empty;
+#if ASYNC_IO
+  struct adv_cond work;
+  struct adv_cond emptysignal;
+  struct st_parameter_dt *pdt;
+  pthread_t thread;
+  struct transfer_queue *head;
+  struct transfer_queue *tail;
 
   struct {
     const char *message;
@@ -361,7 +364,7 @@
     int family;
     bool fatal_error;
   } error;
-
+#endif
 } async_unit;
 
 void init_async_unit (gfc_unit *);

Reply via email to