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 712368 - mini object casts: fix alignment warnings on ARM
mini object casts: fix alignment warnings on ARM
Status: RESOLVED INCOMPLETE
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
1.0.5
Other Linux
: Normal normal
: NONE
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-11-15 14:53 UTC by Gabor Rapcsanyi
Modified: 2017-10-11 10:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed fix (3.77 KB, patch)
2013-11-15 14:53 UTC, Gabor Rapcsanyi
none Details | Review

Description Gabor Rapcsanyi 2013-11-15 14:53:30 UTC
Created attachment 259911 [details] [review]
proposed fix

In EFL WebKit we are using Gstreamer and some header cause this warning:
increases required alignment of target type [-Wcast-align]

I uploaded a proposed fix for that issue.
Comment 1 Olivier Crête 2013-11-15 16:36:11 UTC
Review of attachment 259911 [details] [review]:

This alignment thing is strange, which exact compiler are you using ?

::: gst/gstbuffer.h
@@ +331,3 @@
 gst_buffer_ref (GstBuffer * buf)
 {
+  return GST_BUFFER (gst_mini_object_ref (GST_MINI_OBJECT_CAST (buf)));

use GST_BUFFER_CAST
Comment 2 Gabor Rapcsanyi 2013-11-18 08:53:20 UTC
(In reply to comment #1)
> Review of attachment 259911 [details] [review]:
> 
> This alignment thing is strange, which exact compiler are you using ?


We are using
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.

But we have toolchains made by crosstool-ng and the problem is the same.
For example this code has no warning on x86 but it throws warning on ARM:

g++ -Wcast-align main.cpp

int main() {
  char* a;
  int* b;
  b = reinterpret_cast<int*>(a);
}


> 
> ::: gst/gstbuffer.h
> @@ +331,3 @@
>  gst_buffer_ref (GstBuffer * buf)
>  {
> +  return GST_BUFFER (gst_mini_object_ref (GST_MINI_OBJECT_CAST (buf)));
> 
> use GST_BUFFER_CAST

In gstbuffer.h line 370 you used GST_BUFFER that's why I used it.

gst/gstbuffer.h
367: static inline GstBuffer *
368: gst_buffer_copy (const GstBuffer * buf)
369: {
370:   return GST_BUFFER (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (buf)));
371: }
Comment 3 Sebastian Dröge (slomo) 2013-11-29 15:54:29 UTC
I think these compiler warnings are false warnings. There's nothing that changes any alignment requirements in these casts, other than in your reinterpret_cast example (there the warning is correct).
Comment 4 Olivier Crête 2013-11-29 18:35:15 UTC
I'm quite curious as to why the compiler thinks the alignment is different, GstMiniObject is not a small structure, so it should already max out the alignment requirements. We have the same compiler here, and we can reproduce the warning, but I don't understand it. And the GObject macros do the same thing all over the place.
Comment 5 Sebastian Dröge (slomo) 2014-05-02 12:27:27 UTC
So what should we do about this? As I see it this is just a broken compiler that warns too much...
Comment 6 Tim-Philipp Müller 2016-02-21 23:07:11 UTC
I don't know what to do about this.

Gabor, is this still a problem with more recent linaro toolchains?

It looks wrong to me to add these extra casts, and if it really is needed (and not a false positive) I think we should at least understand why.

Closing for now, but please feel free to re-open if you can provide more information, thanks!
Comment 7 Philip Withnall 2017-10-11 10:34:03 UTC
*** Bug 712370 has been marked as a duplicate of this bug. ***