This is a problem with trying to generate the function call to the compiler helper function for the int to float cast without being in the context of an actual function. The C standard, at least up to C99, only requires support for a constant initializer so I am inclined just to abort the associated code generation after the "Initializer element is not a constant expression" error message. On the other hand, we could synthesize a function context for all the global initializers if we really wanted to support this (this could also fix bug [#2004]). Any other devs have opinions?
Same in the N2479 C2X draft: "All the expressions in an initializer for an object that has static or thread storage duration shall be constant expressions or string literals."
E_CONST_EXPECTED is fine for me.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is a problem with trying to generate the function call to the compiler helper function for the int to float cast without being in the context of an actual function. The C standard, at least up to C99, only requires support for a constant initializer so I am inclined just to abort the associated code generation after the "Initializer element is not a constant expression" error message. On the other hand, we could synthesize a function context for all the global initializers if we really wanted to support this (this could also fix bug [#2004]). Any other devs have opinions?
Related
Bugs:
#2004Same in the N2479 C2X draft: "All the expressions in an initializer for an object that has static or thread storage duration shall be constant expressions or string literals."
E_CONST_EXPECTED is fine for me.
I agree. An error is sufficient.
Yeah, what I consider to be a bug here is the SIGSEGV, not the fact that it would error on a correct implementation.
Issue does not appear in r11795.
I still get the SIGSEGV in [r11795] on my Debian GNU/Linux testing system.
Fixed in [r13427].
No regression test added yet, due to [bugs:#3383]
Related
Bugs:
#3383Commit: [r13427]