[PATCH] D89360: Treat constant contexts as being in the default rounding mode.

2020-10-16 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG7e801ca0efa9: Treat constant contexts as being in the default rounding mode. (authored by rsmith). Repository: rG LLVM Github Monorepo CHANGES SI

[PATCH] D89360: Treat constant contexts as being in the default rounding mode.

2020-10-16 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision. rjmccall added a comment. This revision is now accepted and ready to land. Okay, thanks. This LGTM. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D89360/new/ https://reviews.llvm.org/D89360

[PATCH] D89360: Treat constant contexts as being in the default rounding mode.

2020-10-16 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment. In D89360#2329167 , @rjmccall wrote: > Okay. I can accept the fairly unfortunate thing with `const int` > initializers. When is `IsConstantContext` set in C, just static initializers? This affects static initializers, enumerator

[PATCH] D89360: Treat constant contexts as being in the default rounding mode.

2020-10-16 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith updated this revision to Diff 298724. rsmith added a comment. - Add more testcases to demonstrate behavior in C. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D89360/new/ https://reviews.llvm.org/D89360 Files: clang/lib/AST/ExprConstant.cp

[PATCH] D89360: Treat constant contexts as being in the default rounding mode.

2020-10-15 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added a comment. Probably there is an issue with code generation. The source: constexpr float func_01(float x, float y) { return x + y; } float V1 = func_01(1.0F, 0x0.01p0F); compiled with '-frounding-math' must produce dynamic initializer. It however is evaluated at

[PATCH] D89360: Treat constant contexts as being in the default rounding mode.

2020-10-15 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added a comment. As C++ case is much more complicated and we need a ruleset based on essential properties rather than implementation viewpoint, I am convinced that the solution based on manifestly constant-evaluated property is the best. Thank you for the discussion! Repository: r

[PATCH] D89360: Treat constant contexts as being in the default rounding mode.

2020-10-15 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added a comment. In D89360#2330522 , @rsmith wrote: > In D89360#2329856 , @sepavloff wrote: > >> I would propose to consider solution in D88498 >> . It tries to fix the re

[PATCH] D89360: Treat constant contexts as being in the default rounding mode.

2020-10-14 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments. Comment at: clang/test/SemaCXX/rounding-math.cpp:9 + +constexpr int f(int n) { return int(n * (1.0 / 3.0)); } + rsmith wrote: > sepavloff wrote: > > This code requires additional solution. The function body is built using > > dynami

[PATCH] D89360: Treat constant contexts as being in the default rounding mode.

2020-10-14 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment. In D89360#2329856 , @sepavloff wrote: > I would propose to consider solution in D88498 > . It tries to fix the real reason of the > malfunction - using dynamic rounding mode for evaluation of globa

[PATCH] D89360: Treat constant contexts as being in the default rounding mode.

2020-10-14 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added a comment. I would propose to consider solution in D88498 . It tries to fix the real reason of the malfunction - using dynamic rounding mode for evaluation of global variable initializers. With the workaround for constexpr functions it allows to

[PATCH] D89360: Treat constant contexts as being in the default rounding mode.

2020-10-13 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. Okay. I can accept the fairly unfortunate thing with `const int` initializers. When is `IsConstantContext` set in C, just static initializers? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D89360/new/ https://reviews.llv

[PATCH] D89360: Treat constant contexts as being in the default rounding mode.

2020-10-13 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith created this revision. rsmith added reviewers: rjmccall, mibintc, sepavloff. Herald added a project: clang. rsmith requested review of this revision. This addresses a regression where pretty much all C++ compilations using -frounding-math now fail, due to rounding being performed in constex