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 502927 - g_array_index triggers cast aligment warning
g_array_index triggers cast aligment warning
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2007-12-10 21:19 UTC by Benjamin Otte (Company)
Modified: 2007-12-10 22:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
suggested fix (618 bytes, patch)
2007-12-10 21:22 UTC, Benjamin Otte (Company)
committed Details | Review

Description Benjamin Otte (Company) 2007-12-10 21:19:52 UTC
When compiling on various arm architectures with the gcc flag -Wcast-align enabled, g_array_index() triggers the warning "cast increases required alignment of target type" because it promotes a gchar pointer to the provided type.

This warning is bogus though as the memory is correctly aligned when malloc'd. It can be worked around by an intermediate cast to a void pointer.
Comment 1 Benjamin Otte (Company) 2007-12-10 21:22:14 UTC
Created attachment 100714 [details] [review]
suggested fix
Comment 2 Behdad Esfahbod 2007-12-10 21:40:00 UTC
Looks good to me.
Comment 3 Benjamin Otte (Company) 2007-12-10 22:30:55 UTC
committed.