gcc-4.7-20111022 fails to build on PA-RISC

Jonathan Wakely jwakely.gcc@gmail.com
Sun Oct 30 16:46:00 GMT 2011


Hi all,

This problem came up on the gcc-help list, see
http://gcc.gnu.org/ml/gcc-help/2011-10/msg00241.html

It turns out that the restriction on copying volatile objects
documented in C.1.9 [diff.special] breaks std::mutex for hppa-linux,
where pthread_mutex_t has a volatile member, so cannot be copied
without adding a user-defined copy constructor to the underlying libc
type, which is obviously difficult for us to do.

A reduced test is:

struct lock_t {
    int lock[4];
};

struct pthread_mutex_t {
    volatile lock_t __spinlock;
};

struct mutex {
  pthread_mutex_t m = { };
  mutex() = default;
};

int main()
{
  mutex mx;
}

One solution I can see is to undefine __GTHREAD_MUTEX_INIT etc. on
that platform, so we use the pthread_mutex_init function instead - can
anyone see a better alternative?



More information about the Libstdc++ mailing list