[Bug c/38354] Spurious error: initializer element is not computable at load time
adam at consulting dot net.nz
gcc-bugzilla@gcc.gnu.org
Mon Sep 8 01:21:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38354
--- Comment #6 from Adam Warner <adam at consulting dot net.nz> ---
Just to make sure I understand this correctly:
1. You won't confirm this bug because it violates the C standard.
2. GNU provides extensions to C when the C standard is too restrictive. In this
case the initializer element is *clearly* computable at load time because all
function pointers are *already* 32 bits under the non-large code model.
3. To demonstrate this, a GNU extension to C++ has no problem computing the
address of the function pointer at load time and storing it in a 32-bit integer
array.
4. Just because C is supposed to be a portable assembler and lower level than
C++ doesn't mean you should be able to store a 32-bit address in a 32-bit
integer at load time. Even though GNU C++ can.
5. Use GNU C++ if you want code to run fast when the L1 data cache is being
trashed by function pointer lookup tables that are twice their necessary size.
C has strict type checking which must not be violated at load time. Goto 1.
More information about the Gcc-bugs
mailing list