Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1619354 - wrong result when compiled with -funroll-loops
Summary: wrong result when compiled with -funroll-loops
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 31
Hardware: s390x
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: ZedoraTracker
TreeView+ depends on / blocked
 
Reported: 2018-08-20 15:10 UTC by Dan Horák
Modified: 2020-08-10 14:38 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-08-10 14:38:20 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
reduced standalone test case (1.29 KB, text/plain)
2018-08-20 15:10 UTC, Dan Horák
no flags Details


Links
System ID Private Priority Status Summary Last Updated
IBM Linux Technology Center 173351 0 None None None 2019-08-07 11:14:33 UTC

Description Dan Horák 2018-08-20 15:10:30 UTC
Created attachment 1477282 [details]
reduced standalone test case

Description of problem:
After an introduction of __build_clz() based pow2_ceil() implementation [1] in jemalloc, a unit test [2] started to fail in the test-suite on s390x. It was reported as [3], but it turned into a compiler issue (IMO) caused by the -funroll-loops option.

[1] https://github.com/jemalloc/jemalloc/commit/4c548a61c89b0472b9952fcc4090eb00c2a88870
[2] https://github.com/jemalloc/jemalloc/blob/dev/test/unit/bit_util.c
[3] https://github.com/jemalloc/jemalloc/issues/1307

Version-Release number of selected component (if applicable):
gcc-8.2.1-2.fc29.s390x

Comment 1 Dan Horák 2018-08-20 15:13:40 UTC
Seems it's affecting only s390x, this came from our CI for jemalloc that checks also armv7, aarch64, ppc64, ppc64le and x86_64.

Comment 2 Dan Horák 2018-08-20 15:14:36 UTC
The error message from running the test case is

Failed assertion: (pow2_ceil_u32(((uint32_t)1) << i)) == (((uint32_t)1) << i) --> 1 != 2: Unexpected result, i=1

Comment 3 Marek Polacek 2018-08-20 15:18:20 UTC
Have you tried -fsanitize=undefined?

Comment 4 Dan Horák 2018-08-20 15:24:02 UTC
I've tried now and nothing is reported

[sharkcz@devel10 ~]$ gcc -std=gnu11 -Wall -pipe -g3 -O2 -funroll-loops -fsanitize=undefined -o t t.c
[sharkcz@devel10 ~]$ ./t
Failed assertion: (pow2_ceil_u32(((uint32_t)1) << i)) == (((uint32_t)1) << i) --> 1 != 2: Unexpected result, i=1

Comment 5 Dan Horák 2018-08-20 15:26:03 UTC
for the record, the generic pow2_ceil() produces correct results in the test

Comment 6 IBM Bug Proxy 2018-11-20 16:31:52 UTC
------- Comment From Andreas.Krebbel.com 2018-11-20 11:23 EDT-------
This is a bug in the clztidi2 pattern in the S/390 backend of GCC. I've just committed a patch to mainline.

https://gcc.gnu.org/ml/gcc-patches/2018-11/msg01736.html

Although it appears to be quite difficult to trigger this probably should be backported to basically all distro levels currently in use :(

Comment 7 Dan Horák 2018-11-20 17:24:43 UTC
Hanns, I guess it makes sense to clone this bug for RHEL gcc too.

Comment 8 Hanns-Joachim Uhl 2018-11-21 08:19:05 UTC
(In reply to Dan Horák from comment #7)
> Hanns, I guess it makes sense to clone this bug for RHEL gcc too.
.
Hello Dan,
... agree ... 
... please go ahead cloning this bugzilla to the related RHEL releases ...
Thanks for your attention and support.

Comment 9 Ben Cotton 2019-08-13 16:56:25 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to '31'.

Comment 10 Ben Cotton 2019-08-13 19:14:11 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to 31.


Note You need to log in before you can comment on or make changes to this bug.