[all-commits] [llvm/llvm-project] 27cbfa: [Clang] Propagate const context info when emitting...
Ties Stuij via All-commits
all-commits at lists.llvm.org
Thu Aug 18 03:24:12 PDT 2022
Author: Ties Stuij <ties at stuij.se>
Date: 2022-08-18 (Thu, 18 Aug 2022)
[Clang] Propagate const context info when emitting compound literal
This patch fixes a crash when trying to emit a constant compound literal.
For C++ Clang evaluates either casts or binary operations at translation time,
but doesn't pass on the InConstantContext information that was inferred when
parsing the statement. Because of this, strict FP evaluation (-ftrapping-math)
which shouldn't be in effect yet, then causes checkFloatingpointResult to return
false, which in tryEmitGlobalCompoundLiteral will trigger an assert that the
compound literal wasn't constant.
The discussion here around 'manifestly constant evaluated contexts' was very
helpful to me when trying to understand what LLVM's position is on what
evaluation context should be in effect, together with the explanatory text in
that patch itself:
Reviewed By: rjmccall, DavidSpickett
Differential Revision: https://reviews.llvm.org/D131555
More information about the All-commits