This is an archive of the discontinued LLVM Phabricator instance.

[clang][Interp] Support pointer types in compound assignment operations
ClosedPublic

Authored by tbaeder on Jan 3 2023, 1:18 AM.

Diff Detail

Event Timeline

tbaeder created this revision.Jan 3 2023, 1:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 3 2023, 1:18 AM
tbaeder requested review of this revision.Jan 3 2023, 1:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 3 2023, 1:18 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

I'm pretty far behind on reviews of the interpreter, but this one I noticed while looking th rough it.

clang/lib/AST/Interp/ByteCodeExprGen.cpp
697

This is UB here if LT doesn't contain a value. Additionally, it makes line 712 really odd here. It seems that LT isn't really used anywhere in this function. I know classify is meaningful here (and thus needs to run), but I wonder if we want to make this:

assert(LT && *LT == PT_Ptr); and take out the 1st test on 712.

tbaeder updated this revision to Diff 489694.Jan 16 2023, 9:04 PM
tbaeder marked an inline comment as done.
aaron.ballman added inline comments.Jan 18 2023, 9:46 AM
clang/lib/AST/Interp/ByteCodeExprGen.cpp
714–715

Should this be an early return before we visit anything? Or an assert on the assumption that we should only get here for += and -=?

tbaeder updated this revision to Diff 491619.Jan 23 2023, 11:56 PM
tbaeder marked an inline comment as done.
tbaeder added inline comments.Jan 24 2023, 12:29 AM
clang/lib/AST/Interp/ByteCodeExprGen.cpp
714–715

Sure, that would work as well.

This revision is now accepted and ready to land.Jan 31 2023, 5:18 AM
This revision was landed with ongoing or failed builds.Feb 3 2023, 7:43 AM
This revision was automatically updated to reflect the committed changes.