https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103031
Bug ID: 103031 Summary: [12 Regression] Missing static initializer folding with -frounding-math Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: jsm28 at gcc dot gnu.org CC: rguenth at gcc dot gnu.org Target Milestone: --- One of the recent fixes to avoid inappropriate constant folding with -frounding-math caused the following test to produce an error when building with -frounding-math. Static initializers in C are evaluated at translation time, in the default rounding mode and with exceptions discarded; -frounding-math should not affect this. Indeed, fold-const.c has START_FOLD_INIT and END_FOLD_INIT that are supposed to be used for static initializer folding to implement this, but apparently aren't being effective in this case. Test case: double x = -1ULL; Errors: t.c:1:12: error: initializer element is not computable at load time 1 | double x = -1ULL; | ^ Note: if the initializer is cast to double, things work fine; it's only the case of implicit conversion that has the problem, so maybe something is handled differently for folding an implicit conversion of a static initializer. This breaks building glibc tests for some platforms: https://sourceware.org/pipermail/libc-alpha/2021-October/132475.html