GNOME Bugzilla – Bug 527328
g_static_mutex_lock throws "incompatible pointer" warning/error on ppc
Last modified: 2008-04-13 15:06:01 UTC
Steps to reproduce: Due the different implementations of g_static_mutex_[un]lock between i386/x86_64 and ppc/ppc64 architectures there are problems when an application is compiled with -Werror. I have this code (taken from the OpenHPI project): ----------------------- #include <glib.h> static GStaticMutex oh_uid_lock = G_STATIC_MUTEX_INIT; void oh_uid_initialize(void) { g_static_mutex_lock(&oh_uid_lock); } ----------------------- and it leads after many simplifications onto: ----------------------- typedef struct _GStaticMutex GStaticMutex; struct _GStaticMutex { struct _GMutex *runtime_mutex; }; typedef void* gpointer; gpointer g_atomic_pointer_get (volatile gpointer *atomic); static GStaticMutex oh_uid_lock = { ((void *)0) }; void oh_uid_initialize(void); void oh_uid_initialize(void) { g_atomic_pointer_get (&((&oh_uid_lock)->runtime_mutex)); } ----------------------- and the resulting error message is cc1: warnings being treated as errors test.c: In function ‘oh_uid_initialize’: test.c:23: warning: passing argument 1 of ‘g_atomic_pointer_get’ from incompatible pointer type Stack trace: Other information:
please see also http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=475488 http://bugzilla.gnome.org/show_bug.cgi?id=316221
*** This bug has been marked as a duplicate of 316221 ***