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.
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
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 7Alexandra 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.
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
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