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 728129 - exec_opcodes_sys test fails on Intel i7-2620M when built with clang 3.5
exec_opcodes_sys test fails on Intel i7-2620M when built with clang 3.5
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: orc
git master
Other Linux
: Normal blocker
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 739776 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2014-04-13 19:11 UTC by Sebastian Dröge (slomo)
Modified: 2017-12-01 06:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
orc-bugreport.log (185.20 KB, text/plain)
2014-04-13 19:11 UTC, Sebastian Dröge (slomo)
Details
exec_opcodes_sys.log (184.80 KB, text/plain)
2014-04-13 19:12 UTC, Sebastian Dröge (slomo)
Details
bug report from tegra k1 (240.07 KB, text/x-log)
2015-01-02 15:29 UTC, Ivan Aponte
Details
FAIL exec_opcodes_sys: orc-0.4.28 + i686-linux + gcc-6.4.0 (114.33 KB, text/plain)
2017-12-01 06:43 UTC, Vladimír Čunát
Details

Description Sebastian Dröge (slomo) 2014-04-13 19:11:54 UTC
Created attachment 274209 [details]
orc-bugreport.log

See attached output of the test and orc-bugreport. Happens with git master, .17 and .18 at least. Didn't test earlier versions.
Comment 1 Sebastian Dröge (slomo) 2014-04-13 19:12:18 UTC
Created attachment 274210 [details]
exec_opcodes_sys.log
Comment 2 Sebastian Dröge (slomo) 2014-04-14 19:51:36 UTC
Works when building with gcc 4.9, fails when building with clang 3.5
Comment 3 Sebastian Dröge (slomo) 2014-04-14 21:15:07 UTC
Fixed half of it already
Comment 4 Sebastian Dröge (slomo) 2014-04-15 07:17:47 UTC
The remaining problem here is the convdl and convfl code. The result of casting a float/double to an integer is undefined if the integral part of the float/double can't be represented by the target integer type.

gcc apparently casts everything to 0x80000000 according to the existing code, clang to 0x00000000 or 0x80000000 depending on the phase of moon.

Adding this check to the code
> else if (tmp == 0 && (var32.f > 1.0 || var32.f < -1.0)) tmp = 0x7fffffff
fixes it for most cases. The only remaining problem is that clang returns 0x80000000 in some cases for huge negative numbers, and the check above does not catch that
> if (tmp == 0x80000000 && !(var32.i&0x80000000)) tmp = 0x7fffffff
because the sign bit is set in the float.

We could add another check that automatically changes floats > MAX or < MIN to 0x7fffffff but even then I wouldn't be surprised if the behaviour of the various SIMD instructions to do this conversion is different for the undefined case.


What should we do here?
Comment 5 Sebastian Dröge (slomo) 2014-04-15 07:22:26 UTC
(In reply to comment #4)

> We could add another check that automatically changes floats > MAX or < MIN to
> 0x7fffffff but even then I wouldn't be surprised if the behaviour of the
> various SIMD instructions to do this conversion is different for the undefined
> case.

Actually that already does not work. Huge negative numbers are currently expected to be cast to -0 and huge positive numbers to 0x7fffffff.
Comment 6 Sebastian Dröge (slomo) 2014-04-15 07:24:57 UTC
And even that does not work properly with the audioconvert test, only the internal orc tests.

> else if (%s > 9223372036854775807.0) tmp = 0x7fffffff;
> else if (%s < -9223372036854775808.0) tmp = 0;
Comment 7 Vladimír Čunát 2014-08-23 09:49:28 UTC
With the released version, I still had this and other test problem with gcc on i686-linux. https://bugzilla.gnome.org/show_bug.cgi?id=735273 (unfortunately I didn't notice this report before creating the other one)
Comment 8 Sebastian Dröge (slomo) 2014-11-07 12:25:49 UTC
*** Bug 739776 has been marked as a duplicate of this bug. ***
Comment 9 Ivan Aponte 2015-01-02 15:29:00 UTC
Created attachment 293606 [details]
bug report from tegra k1

bug report tegra k1 (neon) with gcc-4.9
Comment 10 Edward Hervey 2016-02-22 07:54:42 UTC
Ping

Is this still an issue with current orc master ?
Comment 11 Sebastian Dröge (slomo) 2016-02-22 07:55:30 UTC
Yes, nobody fixed anything further since Wim fixed a few of these issues.
Comment 12 Sebastian Dröge (slomo) 2016-11-26 09:45:47 UTC
I'd consider this a blocker now, with clang becoming much more common and compilers becoming more irrational with regard to undefined behaviour.
Comment 13 Edward Hervey 2017-11-14 12:46:29 UTC
no longer the case ?
Comment 14 Sebastian Dröge (slomo) 2017-11-14 14:58:51 UTC
Yes, seems to have been fixed at some point by something. We still make use of undefined behaviour in the ORC C code though, but there's another bug for that.
Comment 15 Vladimír Čunát 2017-12-01 06:43:25 UTC
Created attachment 364715 [details]
FAIL exec_opcodes_sys: orc-0.4.28 + i686-linux + gcc-6.4.0

This doesn't happen on any of my machines with direct access (tried a few times), like https://bugzilla.gnome.org/show_bug.cgi?id=735273#c9

This should be on Dell r815, containing 4x12-core Opterons (most likely 61xx, k10 arch).