Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1960701

Summary: Wrong-code regression starting with gcc 8.2
Product: Red Hat Enterprise Linux 8 Reporter: Jakub Jelinek <jakub>
Component: gccAssignee: Marek Polacek <mpolacek>
gcc sub component: system-version QA Contact: Václav Kadlčík <vkadlcik>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: unspecified CC: ahajkova, fweimer, jakub, jason, ohudlick, vkadlcik
Version: 8.6Keywords: Bugfix, Triaged
Target Milestone: betaFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: gcc-8.5.0-2.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-09 19:35:43 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:

Description Jakub Jelinek 2021-05-14 15:53:06 UTC
As mentioned in https://gcc.gnu.org/PR95226 , gcc 8.2 regressed from 8.1 on the
#include <vector>

struct T {
  unsigned a;
  float b {8.};
};

int main()
{
  T t = {1};
  std::vector<T> tt = {{1}, {2}};
  if (t.a != 1 || t.b != 8.0f || tt[0].a != 1 || tt[0].b != 8.0f || tt[1].a != 2 || tt[1].b != 8.0f)
    __builtin_abort ();
}

testcase (even without optimizations).

Comment 1 Jakub Jelinek 2021-05-14 15:54:22 UTC
This worked fine in gcc <= 7.x, 8.1 and works fine in 9.1 and later too.

Comment 2 Marek Polacek 2021-05-27 21:05:26 UTC
I've investigated this a bit.  The wrong-code started with
https://gcc.gnu.org/git/?p=gcc.git&a=commit;h=bdc2c1ea35c16d3bbd3711430d8035dd54cfcf20
which is a different change than what was committed to (then) trunk:
https://gcc.gnu.org/git/?p=gcc.git&a=commit;h=5603790dbf233c31c60d8877f632c06c4753acfb

I think we should back out the first (fcl_c99) change, add the test in #c0, and then
1) remove array-temp1.C, or
2) apply the second (TREE_READONLY) patch and keep array-temp1.C.

I think trading a wrong-code fix for a missed-optimization fix is a good deal.

I've tested both 1) and 2).  Jason/Jakub, any preference?

2) seems to be in the current trunk still, so is probably fairly safe.

Comment 7 errata-xmlrpc 2021-11-09 19:35:43 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Low: gcc security and bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:4386