Re: A little compiler issue



On Fri, 09 Nov 2007 07:19:22 -0800 Alan M. Evans wrote:

On Fri, 2007-11-09 at 00:04 +0100, RafaÅ MuÅyÅo wrote:
It's not quite gtk related, but do any of you know how to fix a
problem with G_LOCK/G_UNLOCK producing strict aliasing warnings
with -O2 ? I'm looking for a real solution, not something to
silence warnings, like -fno-strict-aliasing ? It seems that there
was once a similar problem (bug 316221) but bugzilla seems to be
either down or otherwise unaccessible, so I can't compare with my
problem.

I presume you're system is x86_64? I asked the same question in July:

http://mail.gnome.org/archives/gtk-app-devel-list/2007-July/msg00038.html

The executive summary for the thread is that it's an incorrect cast in
GLib that only affects x86_64 with optimizations turned on. Likely
you'll have to live with or disable the warnings until 64-bit systems
become common enough that this bites someone with the wherewithall to
track down the proper source of the problem in GLib.

More to the point, if you wanted to track down the problem in glib, it
looks like the answer is here:
http://mail.gnome.org/archives/gtk-app-devel-list/2007-July/msg00069.html
... though it might require some digging to figure out where to fix
it, as glibconfig.h is autogenerated per-platform.

However, need to be careful:
http://mail.gnome.org/archives/gtk-app-devel-list/2007-July/msg00060.html

But, this:
http://groups.google.com/group/comp.lang.c/msg/42f0898e5500d015?hl=en
seems to indicate that it's ok to do the extra cast:

"Equivalently, you can write:

    ((int *)p[i])[j]

which uses the fact that a cast has the same effect as an assignment
to a temporary variable."

At any rate, I'm pretty sure all platforms that glib supports have the
same size pointers for all kinds of pointers, so it's probably moot.

        -brian



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]