llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) <details> <summary>Changes</summary> We're otherwise still pointing to the old type, but with the new offset. --- Full diff: https://github.com/llvm/llvm-project/pull/109238.diff 2 Files Affected: - (modified) clang/lib/AST/ByteCode/Pointer.cpp (+1-1) - (modified) clang/test/AST/ByteCode/codegen.c (+7) ``````````diff diff --git a/clang/lib/AST/ByteCode/Pointer.cpp b/clang/lib/AST/ByteCode/Pointer.cpp index 282953eb991a6b..387cad9b137c02 100644 --- a/clang/lib/AST/ByteCode/Pointer.cpp +++ b/clang/lib/AST/ByteCode/Pointer.cpp @@ -665,7 +665,7 @@ IntPointer IntPointer::atOffset(const ASTContext &ASTCtx, uint64_t FieldOffset = ASTCtx.toCharUnitsFromBits(Layout.getFieldOffset(FieldIndex)) .getQuantity(); - return IntPointer{this->Desc, this->Value + FieldOffset}; + return IntPointer{F->Desc, this->Value + FieldOffset}; } IntPointer IntPointer::baseCast(const ASTContext &ASTCtx, diff --git a/clang/test/AST/ByteCode/codegen.c b/clang/test/AST/ByteCode/codegen.c index 8434992823010e..3c6f17e2b87264 100644 --- a/clang/test/AST/ByteCode/codegen.c +++ b/clang/test/AST/ByteCode/codegen.c @@ -17,3 +17,10 @@ struct B { }; const int A = (char *)(&( (struct B *)(16) )->b[0]) - (char *)(16); // CHECK: @A = constant i32 1 + +struct X { int a[2]; }; +int test(void) { + static int i23 = (int) &(((struct X *)0)->a[1]); + return i23; +} +// CHECK: @test.i23 = internal global i32 4, align 4 `````````` </details> https://github.com/llvm/llvm-project/pull/109238 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits