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 141068 - demos/gtk-demo/changedisplay.c: find_toplevel_at_pointer - warning: dereferencing type-punned pointer will break strict-aliasing rules
demos/gtk-demo/changedisplay.c: find_toplevel_at_pointer - warning: dereferen...
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: Other
2.8.x
Other Linux
: Normal normal
: Small fix
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2004-04-25 13:19 UTC by Chris Sherlock
Modified: 2013-02-11 05:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (885 bytes, patch)
2004-04-25 13:20 UTC, Chris Sherlock
needs-work Details | Review

Description Chris Sherlock 2004-04-25 13:19:26 UTC
find_toplevel_at_pointer fixed to prevent warning by gcc about it breaking strict
aliasing rules. Happens because gdk_window_get_user_data is expecting parameter
2 to be a gpointer*, however it's getting a GtkWidget.

Fixed by creating a gpointer variable pwidget for use in
gdk_window_get_user_data, then assign it's address to GtkWidget *widget.
Comment 1 Chris Sherlock 2004-04-25 13:20:19 UTC
Created attachment 27070 [details] [review]
Proposed patch
Comment 2 Christian Kirbach 2006-06-04 13:52:30 UTC
patch still applies and fixes a warning
Comment 3 Björn Lindqvist 2008-03-27 22:02:05 UTC
Patch introduces an error on this line: 

+    widget = (GtkWidget*)&pwidget;

widget is double-anded from the gpointer.
Comment 4 Björn Lindqvist 2008-03-27 22:03:07 UTC
Didn't mean to change bug status, sorry.
Comment 5 Matthias Clasen 2013-02-11 05:21:50 UTC
closing old bugs; no point in keeping bugs about compiler warnings open for years