Fix declaration that XLC rejected
authorJeff Hammond <jeff.science@gmail.com>
Sun, 16 Jun 2013 20:50:00 +0000 (20:50 +0000)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Tue, 25 Jun 2013 14:03:52 +0000 (16:03 +0200)
Changed volatile void* volatile* declarator to volatile void* volatile.

Fixes #1284

Change-Id: I133f480b060ab4723988bd3059e5bd20ebc9df7a

include/thread_mpi/atomic/xlc_ppc.h

index 0dd1f6753a6da2b1f00b1f93e785f95be3ac6e85..3b4f985db3e34f0f2186bb24016332814c5d618d 100644 (file)
@@ -83,7 +83,10 @@ tMPI_Atomic_t;
 
 typedef struct tMPI_Atomic_ptr
 {
-    volatile char* volatile* value __attribute__ ((aligned(64)));  /*!< Volatile, to avoid compiler aliasing */
+    /* volatile char* volatile is not a bug, but means a volatile pointer
+       to a volatile value. This is needed for older versions of
+       xlc. */
+    volatile char* volatile value __attribute__ ((aligned(64)));  /*!< Volatile, to avoid compiler aliasing */
 }
 tMPI_Atomic_ptr_t;
 
@@ -139,8 +142,8 @@ static inline int tMPI_Atomic_ptr_cas(tMPI_Atomic_ptr_t *a, void* oldval,
                                       void* newval)
 {
     int ret;
-    volatile char* volatile* oldv = oldval;
-    volatile char* volatile* newv = newval;
+    volatile char* volatile oldv = (char*)oldval;
+    volatile char* volatile newv = (char*)newval;
 
     __fence(); /* this one needs to be here to avoid ptr. aliasing issues */
     __eieio();