Skip to content

Commit 3dafa48

Browse files
authored
[clang][bytecode] Don't narrow() when dereferencing to array type (#129524)
It doesn't make sense to do this if the result is supposed to be an array.
1 parent 0303fd2 commit 3dafa48

File tree

2 files changed

+393
-4
lines changed

2 files changed

+393
-4
lines changed

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6039,14 +6039,12 @@ bool Compiler<Emitter>::VisitUnaryOperator(const UnaryOperator *E) {
60396039
// We should already have a pointer when we get here.
60406040
return this->delegate(SubExpr);
60416041
case UO_Deref: // *x
6042-
if (DiscardResult) {
6043-
// assert(false);
6042+
if (DiscardResult)
60446043
return this->discard(SubExpr);
6045-
}
60466044

60476045
if (!this->visit(SubExpr))
60486046
return false;
6049-
if (classifyPrim(SubExpr) == PT_Ptr)
6047+
if (classifyPrim(SubExpr) == PT_Ptr && !E->getType()->isArrayType())
60506048
return this->emitNarrowPtr(E);
60516049
return true;
60526050

0 commit comments

Comments
 (0)