llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) <details> <summary>Changes</summary> We'd accidentally leave the subexpr pointer on the stack. --- Full diff: https://github.com/llvm/llvm-project/pull/181323.diff 2 Files Affected: - (modified) clang/lib/AST/ByteCode/Compiler.cpp (+2-2) - (modified) clang/test/AST/ByteCode/complex.cpp (+1) ``````````diff diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index dd10ad7d82653..16f339e4af816 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -6998,7 +6998,7 @@ bool Compiler<Emitter>::VisitComplexUnaryOperator(const UnaryOperator *E) { }; switch (E->getOpcode()) { - case UO_Minus: + case UO_Minus: // -x if (!prepareResult()) return false; if (!createTemp()) @@ -7047,7 +7047,7 @@ bool Compiler<Emitter>::VisitComplexUnaryOperator(const UnaryOperator *E) { return this->emitArrayElemPop(classifyPrim(E->getType()), 1, E); case UO_Not: // ~x - if (!this->visit(SubExpr)) + if (!this->delegate(SubExpr)) return false; // Negate the imaginary component. if (!this->emitArrayElem(ElemT, 1, E)) diff --git a/clang/test/AST/ByteCode/complex.cpp b/clang/test/AST/ByteCode/complex.cpp index 783ea3f15de43..f0b86a968d492 100644 --- a/clang/test/AST/ByteCode/complex.cpp +++ b/clang/test/AST/ByteCode/complex.cpp @@ -162,6 +162,7 @@ static_assert(__real(Doubles[3]) == 0.0, ""); static_assert(__imag(Doubles[3]) == 0.0, ""); static_assert(~(0.5 + 1.5j) == (0.5 + -1.5j), ""); +int array[~(1i) == 2000.0]; void func(void) { __complex__ int arr; `````````` </details> https://github.com/llvm/llvm-project/pull/181323 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
