aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorTies Stuij <ties@stuij.se>2022-08-18 11:25:07 +0100
committerTies Stuij <ties.stuij@arm.com>2022-08-18 11:25:20 +0100
commit27cbfa7cc8cdab121842adf4dd31f6811f523928 (patch)
treefb868bf1fed7c4d4d0da49975246292d5dda45b4 /llvm/lib/CodeGen/CodeGenPrepare.cpp
parenteeac8944180e338754ffce585ae4a2e1f1deeb21 (diff)
downloadllvm-27cbfa7cc8cdab121842adf4dd31f6811f523928.zip
llvm-27cbfa7cc8cdab121842adf4dd31f6811f523928.tar.gz
llvm-27cbfa7cc8cdab121842adf4dd31f6811f523928.tar.bz2
[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: https://reviews.llvm.org/D87528 Reviewed By: rjmccall, DavidSpickett Differential Revision: https://reviews.llvm.org/D131555
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
0 files changed, 0 insertions, 0 deletions