Author: Timm Baeder Date: 2026-02-13T09:17:46+01:00 New Revision: 25ea9206993134e1e93e840f3391aa35204a5204
URL: https://github.com/llvm/llvm-project/commit/25ea9206993134e1e93e840f3391aa35204a5204 DIFF: https://github.com/llvm/llvm-project/commit/25ea9206993134e1e93e840f3391aa35204a5204.diff LOG: [clang][bytecode] Fix already initializing _Complex UO_Not (#181323) We'd accidentally leave the subexpr pointer on the stack. Added: Modified: clang/lib/AST/ByteCode/Compiler.cpp clang/test/AST/ByteCode/complex.cpp Removed: ################################################################################ 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; _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
