https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83222
Bug ID: 83222 Summary: [ 8 regression] Inconsistent "initializer element is not constant" error Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: critical Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: ian at airs dot com Target Milestone: --- The handling of this C program recently changed: const char _expA = 0x42; void __cgo_f_1_4(void) { static const double x = (double)(_expA); } With a GCC built on October 10, 2017, I get this: foo.c: In function ‘__cgo_f_1_4’: foo.c:2:50: error: initializer element is not constant void __cgo_f_1_4(void) { static const double x = (double)(_expA); } ^ With this morning's sources (November 29, 2017) the program compiles without error. Perhaps that change is OK. But this similar program still fails: const char _expA = 0x42; double __cgodebug_floats[] = { _expA, 1 }; foo1.c:3:3: error: initializer element is not constant _expA, ^~~~~ foo1.c:3:3: note: (near initialization for ‘__cgodebug_floats[0]’) I think that if we are going to change the behavior for the first program, we need to change the behavior for the second one.