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 348114 - [PPC64?] [gcc-4.1.2?] GST_BUFFER_IN_CAPS flag should have been copied !
[PPC64?] [gcc-4.1.2?] GST_BUFFER_IN_CAPS flag should have been copied !
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: 0.10.21
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 465280 (view as bug list)
Depends on:
Blocks: 359577
 
 
Reported: 2006-07-20 10:24 UTC by Edward Hervey
Modified: 2008-07-10 15:10 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Edward Hervey 2006-07-20 10:24:48 UTC
The lib/gdp test fails in test_buffer on PPC64 (p5 buildbot).

As of today, it is deactivated on that architecture.

Do not close this bug unless:
_ the #ifndef is removed
_ AND the bug is fixed
Comment 1 Tim-Philipp Müller 2006-07-20 10:35:32 UTC
I thought this was a compiler bug?
Comment 2 Edward Hervey 2006-07-20 10:58:06 UTC
I thought it correct to put an entry in bugzilla for that suppression so we can eventually figure out what's going wrong once and for all.

If there's no solution to this issue... I guess we'll be able to close the bug.
Comment 3 Edward Hervey 2006-08-08 13:47:03 UTC
The same error comes up in a gst-plugins-bad test.

Running suite(s): gdpdepay
66%: Checks: 3, Failures: 1, Errors: 0
elements/gdpdepay.c:349:F:general:test_streamheader: Assertion 'GST_BUFFER_FLAG_IS_SET (outbuffer, GST_BUFFER_FLAG_IN_CAPS)' failed
FAIL: elements/gdpdepay


I commented it so it doesn't get compiled/run on PPC64 and added in the sourcecode this bug number.
Comment 4 Tim-Philipp Müller 2007-05-22 13:43:16 UTC
This bug seems to return in form of a failed unit test (didn't look too closely, just looks like the same issue):

Running suite(s): streamheader
50%: Checks: 2, Failures: 1, Errors: 0
pipelines/streamheader.c:198:F:general:test_multifdsink_gdp_vorbisenc:0: 'n_in_caps' (0) is not equal to '3' (3)
Comment 5 Tim-Philipp Müller 2007-06-14 19:54:00 UTC
> pipelines/streamheader.c:198:F:general:test_multifdsink_gdp_vorbisenc:0:

Disabled this test as well on PPC64 until this issue is resolved on the build bot.

Comment 6 Tim-Philipp Müller 2007-10-28 13:33:31 UTC
*** Bug 465280 has been marked as a duplicate of this bug. ***
Comment 7 Sebastian Dröge (slomo) 2007-12-01 10:26:23 UTC
The elements/gdpdepay failure also happens on ppc32 and s390 with gcc 4.2.3.
Comment 8 Sebastian Dröge (slomo) 2007-12-01 10:31:40 UTC
Hm, no:

Running suite(s): data protocol
80%: Checks: 5, Failures: 1, Errors: 0
libs/gdp.c:150:F:general:tf:0: GST_BUFFER_IN_CAPS flag should have been copied !
FAIL: libs/gdp

Not only gdpdepay but also libs/gdp :)
Comment 9 Sebastian Dröge (slomo) 2007-12-01 10:32:21 UTC
...which is noted in the PPC/s390 part of bug #500833
Comment 10 Sebastian Dröge (slomo) 2008-04-21 11:29:14 UTC
Ok, took a closer look at it on powerpc (32 bit) again today.

First of all we do:

GST_WRITE_UINT16_BE (h + 42, GST_BUFFER_FLAGS (buffer) & flags_mask);

GST_BUFFER_FLAGS (buffer) is a gint (i.e. 32 bit), so we write the wrong part of it to h on big endian architectures.

Putting the result in a guint16 before doesn't help much though. But when compiling with -O0 or putting some debug printf around that line of code "fixes" it... so it really seems to be a compiler bug. This is with gcc 4.3.1 btw...
Comment 11 Sebastian Dröge (slomo) 2008-06-30 09:37:55 UTC
2008-06-30  Sebastian Dröge  <sebastian.droege@collabora.co.uk>

	* libs/gst/dataprotocol/dataprotocol.c:
	Don't write to the same region of memory as a uint64 and uint16
	as this breaks strict aliasing rules and apparantly breaks on PPC
	and s390. Thanks to Sjoerd Simons for analysing. Fixes bug #348114.
Comment 12 Michael Smith 2008-06-30 17:38:31 UTC
Just a note: this is a workaround for what really sounds to me like a compiler bug. I'm pretty sure we're not violating strict-aliasing rules (the underlying type is an unsigned char pointer; type-aliasing on those is explicitly permitted).

The patch also removes the only 'documentation' I could see for what those 16 bytes actually were, in the protocol.
Comment 13 Sebastian Dröge (slomo) 2008-07-02 09:08:00 UTC
The GDP packet is documented in the gst-libs/dataprotocol documentation. There this 16 bytes are documented too (first 2 are buffer flags, other's are ABI padding).
Comment 14 Tim-Philipp Müller 2008-07-09 09:05:16 UTC
I'm wondering: doesn't this imply that we either need to remove the GST_HAVE_UNALIGNED_ACCESS bits in gstutils.h (ie. GST_READ_* GST_WRITE_*) or make sure that both GStreamer and any app/plugin using it is compiled with -fno-strict-aliasing at all times (not sure how one would do that though)? Just adding a warning to the docs doesn't really cut it imho, since the whole point of these macros is that the developer doesn't need to worry/know about things like alignment etc.
Comment 15 David Schleef 2008-07-09 17:58:51 UTC
Could someone with access to a failing machine attach the disassembled code?  I'm leaning toward compiler bug as well.
Comment 16 Sebastian Dröge (slomo) 2008-07-09 18:24:23 UTC
(In reply to comment #15)
> Could someone with access to a failing machine attach the disassembled code? 
> I'm leaning toward compiler bug as well.

One of the Debian gcc maintainers disagrees: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=488563

I'll provide disassembled code of Sjoerd's testcase tomorrow
Comment 17 David Schleef 2008-07-09 18:45:41 UTC
Never mind.  I misread the code.  It is an aliasing problem.  The patch is correct.

I think a warning in the documentation is a good idea.
Comment 18 Tim-Philipp Müller 2008-07-10 12:11:34 UTC
> I think a warning in the documentation is a good idea.

Do you think that's sufficient though? If this issue isn't immediately obvious to a number of core GStreamer hackers, do we really expect users of our API to fully grasp the implications? And even if they do, what are they supposed to do? Hack their own unaligned versions of the GST_READ_* macros?

I think it'd be better to change the GST_READ_*/GST_WRITE_* macros to the 'slow but safe' versions and add _FAST variants or something which hackers can use if they know that it's safe to do so.
Comment 19 Sebastian Dröge (slomo) 2008-07-10 15:10:55 UTC
IMHO the GST_READ/WRITE macros should use the slow and safe version always and everywhere.