Bug 199604 - Openssl compiled with latest gcc fails sha512 test
Openssl compiled with latest gcc fails sha512 test
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: gcc (Show other bugs)
s390 Linux
medium Severity medium
: rc
: ---
Assigned To: Jakub Jelinek
Michal Nowak
Depends On:
  Show dependency treegraph
Reported: 2006-07-20 14:23 EDT by Tomas Mraz
Modified: 2013-03-07 21:03 EST (History)
5 users (show)

See Also:
Fixed In Version: gcc-4.4.1-22.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-07-02 15:06:13 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
The sha512 source (15.45 KB, text/x-csrc)
2006-07-21 02:35 EDT, Tomas Mraz
no flags Details
Self contained testcase (10.93 KB, text/x-csrc)
2006-07-21 04:01 EDT, Tomas Mraz
no flags Details
Patch that appears to fix the bug (3.35 KB, patch)
2006-07-26 06:59 EDT, Alexandre Oliva
no flags Details | Diff
Trivial backport of the patch I'm checking in upstream to fix the bug (6.93 KB, patch)
2006-08-17 04:43 EDT, Alexandre Oliva
no flags Details | Diff

  None (edit)
Description Tomas Mraz 2006-07-20 14:23:34 EDT
Description of problem:
OpenSSL library compiled with latest gcc fails the sha512 test. 

Version-Release number of selected component (if applicable):
The latest known-to-work version is gcc-4.1.1-7, the first known-to-not-work
version is gcc-4.1.1-9. I'll try to isolate a testcase however it would have to
be probably a whole sha512 routine.

Note that the sha512 code depends on long long which might be of some
significance to this bug report.

How reproducible:

Steps to Reproduce:
1. build openssl in dist-fc6, see build.log on s390
Comment 1 Tomas Mraz 2006-07-21 02:33:16 EDT
The test fails with these optimization options:
-O1 -fschedule-insns -fregmove
Comment 2 Tomas Mraz 2006-07-21 02:35:49 EDT
Created attachment 132779 [details]
The sha512 source

B_ENDIAN is defined when compiling on s390.
Comment 3 Tomas Mraz 2006-07-21 04:01:59 EDT
Created attachment 132782 [details]
Self contained testcase

I cannot make it fail when I replace -O1 with individual -f options according
to the info manual.
Comment 4 Alexandre Oliva 2006-07-26 06:59:41 EDT
Created attachment 133061 [details]
Patch that appears to fix the bug

This is the patch I'm bootstrap-testing.  I've already verified that it fixes
the bug on s390.
Comment 5 Alexandre Oliva 2006-08-17 04:43:24 EDT
Created attachment 134369 [details]
Trivial backport of the patch I'm checking in upstream to fix the bug

A major rework of the patch was accepted upstream.  This is a trivial backport
of it.
Comment 6 Tomas Mraz 2007-07-24 13:07:29 EDT
Is this patch included in the current gcc in rawhide?
Comment 7 Tomas Mraz 2007-07-24 14:38:09 EDT
Answering my own question - it doesn't seem to be in upstream 4.1.2. It is in
4.2.0 and newer.
Comment 8 Bug Zapper 2008-04-03 13:49:30 EDT
Based on the date this bug was created, it appears to have been reported
against rawhide during the development of a Fedora release that is no
longer maintained. In order to refocus our efforts as a project we are
flagging all of the open bugs for releases which are no longer
maintained. If this bug remains in NEEDINFO thirty (30) days from now,
we will automatically close it.

If you can reproduce this bug in a maintained Fedora version (7, 8, or
rawhide), please change this bug to the respective version and change
the status to ASSIGNED. (If you're unable to change the bug's version
or status, add a comment to the bug and someone will change it for you.)

Thanks for your help, and we apologize again that we haven't handled
these issues to this point.

The process we're following is outlined here:

We will be following the process here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping to ensure this
doesn't happen again.
Comment 9 Tomas Mraz 2008-04-04 07:42:02 EDT
This should be fixed in rawhide (gcc 4.3) but it is hard to verify as Fedora
doesn't have s390(x) build machines. Perhaps just moving the bug to RHEL-6 would
be most appropriate so it is closed when it is verified that openssl
rebuilds/tests fine on s390(x) without the workaround?
Comment 10 John Poelstra 2008-05-05 19:26:09 EDT
okay changing to RHEL
Comment 11 Bill Nottingham 2008-10-09 16:05:39 EDT
RHEL 6 will include at least gcc-4.3, so this should not be a problem. Setting to MODIFIED.

The feature requested has already been accepted into the upstream code base
planned for the next major release of Red Hat Enterprise Linux.

When the next milestone release of Red Hat Enterprise Linux 6 is available,
please verify that the feature requested is present and functioning as
Comment 12 RHEL Product and Program Management 2009-02-05 18:31:44 EST
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
Comment 13 Jakub Jelinek 2009-09-21 15:15:03 EDT
PR28146 is certainly fixed in GCC 4.4.
Comment 14 releng-rhel@redhat.com 2009-10-29 09:44:14 EDT
Fixed in 'gcc-4.4.1-22.el6', included in compose 'RHEL6.0-20091028.0'.
Moving to ON_QA.
Comment 15 Michal Nowak 2010-04-21 08:51:43 EDT

On which architectures should testcasesha512.c pass? I compile with -O{s,0,1,2,3}. Currently it passes at PPC64 & S390x. On x86-64 fails for all optimization. And on i686

* -O0 fails:

:: [   PASS   ] :: Running 'gcc -O0 -fschedule-insns -fregmove testcasesha512.c -o testcasesha512-opt-O0'

TEST failed.
:: [   FAIL   ] :: Running './testcasesha512-opt-O0' (Expected 0, got 1)

* with any other optimization gcc bails out:

testcasesha512.c: In function ‘SHA512_Update’:
testcasesha512.c:179: error: unable to find a register to spill in class ‘CREG’
testcasesha512.c:179: error: this is the insn:
(insn 108 210 112 18 testcasesha512.c:165 (parallel [
            (set (reg:SI 3 bx [99])
                (const_int 0 [0x0]))
            (set (reg/f:SI 5 di [orig:91 p ] [91])
                (plus:SI (ashift:SI (reg:SI 3 bx [98])
                        (const_int 2 [0x2]))
                    (reg/f:SI 5 di [orig:91 p ] [91])))
            (set (reg:SI 4 si [92])
                (plus:SI (ashift:SI (reg:SI 3 bx [98])
                        (const_int 2 [0x2]))
                    (reg:SI 4 si [92])))
            (set (mem:BLK (reg/f:SI 5 di [orig:91 p ] [91]) [0 A8])
                (mem:BLK (reg:SI 4 si [92]) [0 A8]))
            (use (reg:SI 3 bx [98]))
        ]) 638 {*rep_movsi} (expr_list:REG_DEAD (reg:SI 3 bx [98])
        (expr_list:REG_UNUSED (reg:SI 3 bx [99])
testcasesha512.c:179: confused by earlier errors, bailing out
Preprocessed source stored into /tmp/ccvONx9G.out file, please attach this to your bugreport.
:: [   FAIL   ] :: Running 'gcc -O1 -fschedule-insns -fregmove testcasesha512.c -o testcasesha512-opt-O1' (Expected 0, got 1)

Where should the test case pass/fail?
Comment 16 Jakub Jelinek 2010-04-21 08:59:44 EDT
-fschedule-insns isn't supported on x86-64 nor i686 (and, shouldn't be used anywhere with -O0).  Only GCC 4.5 has some -fschedule-insns support for x86-64/i686 with register pressure sensitive scheduling.
Comment 18 releng-rhel@redhat.com 2010-07-02 15:06:13 EDT
Red Hat Enterprise Linux Beta 2 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.

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