Skip to content

Commit 89b0095

Browse files
committed
Revert "[clang][Interp] Use placement new to construct opcode args into vector"
This reverts commit aaf73ae. This breaks sanitized builds because the constructor is called with an unaligned address.
1 parent ec23e55 commit 89b0095

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

clang/lib/AST/Interp/ByteCodeEmitter.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,8 @@ static void emit(Program &P, std::vector<char> &Code, const T &Val,
163163
}
164164

165165
if constexpr (!std::is_pointer_v<T>) {
166-
// Construct the value directly into our storage vector.
167-
size_t ValPos = Code.size();
168-
Code.resize(Code.size() + Size);
169-
new (Code.data() + ValPos) T(Val);
166+
const char *Data = reinterpret_cast<const char *>(&Val);
167+
Code.insert(Code.end(), Data, Data + Size);
170168
} else {
171169
uint32_t ID = P.getOrCreateNativePointer(Val);
172170
const char *Data = reinterpret_cast<const char *>(&ID);

0 commit comments

Comments
 (0)