This is an archive of the discontinued LLVM Phabricator instance.

[clang][Interp] Use placement new to construct opcode args into vector
ClosedPublic

Authored by tbaeder on Dec 2 2022, 2:52 AM.

Details

Summary

The last version of this patch created problems because it was using the placement new with unaligned addresses.

This version tries to address this issue. I've enabled ubsan locally and not seen problems when running the interpreter test suite.

Diff Detail

Event Timeline

tbaeder created this revision.Dec 2 2022, 2:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 2 2022, 2:52 AM
tbaeder requested review of this revision.Dec 2 2022, 2:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 2 2022, 2:52 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Generally looks correct to me.

clang/lib/AST/Interp/PrimType.h
62

I think Size should be something more like Value -- I was thrown off by the pointer-based aligned that was treating the pointer as an integer value for Size. :-D

66

Pedantically, this should be casting through uintptr_t rather than size_t.

tbaeder updated this revision to Diff 480873.Dec 7 2022, 5:45 AM
tbaeder marked 2 inline comments as done.
This revision is now accepted and ready to land.Jan 13 2023, 11:48 AM