After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 507134 - G_LOCK() and G_UNLOCK() might break strict-aliasing rules
G_LOCK() and G_UNLOCK() might break strict-aliasing rules
Status: RESOLVED DUPLICATE of bug 316221
Product: glib
Classification: Platform
Component: general
2.15.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2008-01-03 22:55 UTC by Sebastian Dröge (slomo)
Modified: 2008-02-08 00:06 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sebastian Dröge (slomo) 2008-01-03 22:55:52 UTC
Hi,
when compiling the code below with gcc 4.3 (trunk revision 131293) with -fstrict-aliasing and -Wall -Werror one gets the following compiler output:

gcc-4.3 -o tset test.c -Wall `pkg-config --libs --cflags glib-2.0` -Werror -fstrict-aliasing -O0
cc1: warnings being treated as errors
test.c: In function ‘main’:
test.c:7: error: dereferencing type-punned pointer will break strict-aliasing rules
test.c:8: error: dereferencing type-punned pointer will break strict-aliasing rules

Is this a GLib bug or a gcc one? gcc 4.2 and below didn't complain so either gcc became more correct or more buggy ;)

This is with glib 2.15.0...


test code:

#include <glib.h>

G_LOCK_DEFINE_STATIC (test_lock);

int main()
{
  G_LOCK (test_lock);
  G_UNLOCK (test_lock);
  return 0;
}
Comment 1 Dan Williams 2008-02-08 00:06:34 UTC

*** This bug has been marked as a duplicate of 316221 ***