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 1672652 - GCC error "initializer element is not constant" in gnu99 mode
Summary: GCC error "initializer element is not constant" in gnu99 mode
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: gcc
Version: 7.6
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: 7.7
Assignee: Marek Polacek
QA Contact: Alexandra Petlanová Hájková
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-02-05 14:19 UTC by Thomas Huth
Modified: 2019-08-06 13:01 UTC (History)
5 users (show)

Fixed In Version: gcc-4.8.5-38.el7
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-08-06 13:00:39 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:2167 0 None None None 2019-08-06 13:01:01 UTC

Description Thomas Huth 2019-02-05 14:19:14 UTC
Description of problem:
When compiling certain C code in gnu99 mode with the gcc v4.8.5 from RHEL7, I get the error "initializer element is not constant" and the compilation fails. The same code compiles fine in gnu89 mode or with later versions of GCC (e.g. version 8.x).

Version-Release number of selected component (if applicable):
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)

How reproducible:
100%

Steps to Reproduce:
1. cat > gnu99bug.c <<EOF
  typedef struct {
      int value;
  } mytype_t;

  mytype_t myvar = (mytype_t) { .value =  0 };
EOF
2. gcc -Wall -std=gnu99 -c gnu99bug.c

Actual results:
gnu99bug.c:5:1: error: initializer element is not constant

Expected results:
gcc should compile this fine in gnu99 mode, just like later versions of gcc do it, and like it is also working fine in gnu89 mode.

Additional info:
I think this might be the upstream bug ticket:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63567

Comment 2 Marek Polacek 2019-02-05 20:18:42 UTC
We'd have to backport gcc.gnu.org/r216416 and gcc.gnu.org/r216440.  I'm not sure if I want to backport those; how important is this?

Comment 3 Thomas Huth 2019-02-06 06:15:43 UTC
I think it is quite important. Since the GCC from RHEL7 is still using "gnu89" by default, while the GCCs of other newer distributions are using "gnu11" by default now, many upstream projects slowly switch away from "gnu89" and enforce either gnu99 or gnu11 for their project now. If the GCC from RHEL7 can not compile these projects in gnu99 (or gnu11) mode anymore, there is a chance that the projects stop support for RHEL7 completely.
We've hit this problem when we switched the compile mode of the QEMU project to gnu99 recently:

 https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg03279.html

In that particular case, I was fortunately able to work-around the problem by manually changing the affected code, but I'm afraid that we will hit this problem sooner or later again, and not all cases can be solved easily (e.g. if the affected code is buried in the header of a library instead where you do not have direct control of).

Comment 7 Alexandra Petlanová Hájková 2019-04-18 10:10:41 UTC
Reproduced on gcc-4.8.5-36.el7_6.1.x86_64. Corresponding tests passes on gcc-4.8.5-39.el7.

Comment 9 errata-xmlrpc 2019-08-06 13:00:39 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, 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/RHBA-2019:2167


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