This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/71983] New: "error: initializer element is not constant" only with -O0
- From: "k2k at narod dot ru" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 23 Jul 2016 17:32:00 +0000
- Subject: [Bug c/71983] New: "error: initializer element is not constant" only with -O0
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71983
Bug ID: 71983
Summary: "error: initializer element is not constant" only with
-O0
Product: gcc
Version: 6.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: k2k at narod dot ru
Target Milestone: ---
Got error "error: initializer element is not constant" when following code is
compiled with '-O0'
int main(void)
{
static const int a = 1;
static const int b = 2;
static const int c = a + b;
return c;
}
If same code is compiled with -O1, -O2, -O3, -Ofast or even -Og, no errors and
no warnings are generated.