Bug 1797160

Summary: gcc 10: g++ ICE on s390x
Product: [Fedora] Fedora Reporter: Jerry James <loganjerry>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 32CC: aoliva, avi.kivity, dmalcolm, fweimer, jakub, jwakely, law, mpolacek, msebor, nickc, sipoyare
Target Milestone: ---   
Target Release: ---   
Hardware: s390x   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-31 09:30:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1800201    
Attachments:
Description Flags
Compressed preprocessed source none

Description Jerry James 2020-02-01 04:16:13 UTC
Created attachment 1656894 [details]
Compressed preprocessed source

Description of problem:
During the mass rebuild, tlx failed to build on s390x only, due to an internal compiler error in g++.  I removed compiler flags until it went away, so I can report that the ICE does not happen with -O0, but does with all higher optimization levels.  With only some preprocessor options and -O as arguments, this is the output:

/builddir/build/BUILD/tlx-0.5.20191212/tests/math_test.cpp: In function 'void test_popcount()':
/builddir/build/BUILD/tlx-0.5.20191212/tests/math_test.cpp:220:1: error: unrecognizable insn:
  220 | }
      | ^
(insn 138 137 139 27 (set (reg:SI 190)
        (ashift:SI (reg:HI 95 [ _105 ])
            (const_int 8 [0x8]))) -1
     (nil))
during RTL pass: vregs
/builddir/build/BUILD/tlx-0.5.20191212/tests/math_test.cpp:220:1: internal compiler error: in extract_insn, at recog.c:2294
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccS4ewtK.out file, please attach this to your bugreport.

The preprocessed source is attached.

Version-Release number of selected component (if applicable):
gcc-c++-10.0.1-0.6.fc32.s390x

How reproducible:
Always

Steps to Reproduce:
1. Run g++ -O on the attached preprocessed source
2.
3.

Actual results:
Internal compiler error

Expected results:
An object file

Additional info:

Comment 1 Jakub Jelinek 2020-02-01 11:40:16 UTC
Simplified testcase with -O -march=zEC12:
unsigned short a;

unsigned
foo (void)
{
  a = a - (a >> 1 & 21845);
  a = (a & 13107) + (a >> 2 & 13107);
  return (unsigned short) ((a + (a >> 4) & 3855) * 257) >> 8;
}

Started with https://gcc.gnu.org/r276721 when the above started to be recognized as 16-bit popcount.

Comment 2 Ben Cotton 2020-02-11 16:40:37 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 32 development cycle.
Changing version to 32.