Previously initializers wereSupport of rounding mode in constant evaluated using rounding mode currentlyion resulted in some
specified by Sema. If at the same time FP exception behavior was setnumber of compile errors for constructs that previously were compiled
to `strict`successfully. For example, compilerthe following code starts failed to ing at
compile the following C code:ation if FP exception behavior is set to `strict`:
struct S { float f; };
static struct S x = {0.63};
This happeneds because setting strict behavior sets rounding mode to
`dymanic`. In this case the value of initializer depends on the current
rounding mode and it cannot be evaluated in compile time.
Initializers for some objects must be constants.Using `dynamic` as rounding mode make no sense outside function bodies.
For example, even if the initializer is evaluated dynamically, this happens
before the execution of `main`, On the other hand usingso there is no possibility to set dynamic
`dynamic` as rounding mode make no senserounding mode for it. C requires that initializers are evaluated using
constant rounding mode. It makes sense to apply this rule to C++ as well.
With this change dynamic rounding mode is applied to function bodies. Even in C++ if the initializerIn
is evaluated dynamically, it happens before execution of `main`other cases, solike evaluation of initializers the constant rounding mode
there is no possibility to set rounding mode for such initializers.is applied, Sowhich is 'tonearest' unless it was changed by '#pragma STDC
if rounding mode is `dynamic` when an initializer is evaluated in someFENV_ROUND'.
cases, compiler replaces it with default `tonearest` rounding.