aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/APFloat.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <pcc@google.com>2025-03-05 21:15:08 -0800
committerGitHub <noreply@github.com>2025-03-05 21:15:08 -0800
commitc72ebeeb7f1cebb481243cce3a5b18f548a9d930 (patch)
tree0ede2e48b5d2440e9840ee9811bcf016fad2f68c /llvm/lib/Support/APFloat.cpp
parentf905bf3e1ef860c4d6fe67fb64901b6bbe698a91 (diff)
downloadllvm-c72ebeeb7f1cebb481243cce3a5b18f548a9d930.zip
llvm-c72ebeeb7f1cebb481243cce3a5b18f548a9d930.tar.gz
llvm-c72ebeeb7f1cebb481243cce3a5b18f548a9d930.tar.bz2
ADT: Switch to a raw pointer for DoubleAPFloat::Floats.
In order for the union APFloat::Storage to permit access to the semantics field when another union member is stored there, all members of Storage must be standard layout. This is not necessarily the case for DoubleAPFloat which may be non-standard layout because there is no requirement that its std::unique_ptr member is standard layout. Fix this by converting Floats to a raw pointer. Reviewers: arsenm Reviewed By: arsenm Pull Request: https://github.com/llvm/llvm-project/pull/129981
Diffstat (limited to 'llvm/lib/Support/APFloat.cpp')
-rw-r--r--llvm/lib/Support/APFloat.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp
index cbee7f4..cfc3c3b 100644
--- a/llvm/lib/Support/APFloat.cpp
+++ b/llvm/lib/Support/APFloat.cpp
@@ -4876,8 +4876,9 @@ DoubleAPFloat::DoubleAPFloat(const DoubleAPFloat &RHS)
}
DoubleAPFloat::DoubleAPFloat(DoubleAPFloat &&RHS)
- : Semantics(RHS.Semantics), Floats(std::move(RHS.Floats)) {
+ : Semantics(RHS.Semantics), Floats(RHS.Floats) {
RHS.Semantics = &semBogus;
+ RHS.Floats = nullptr;
assert(Semantics == &semPPCDoubleDouble);
}