AaronBallman wrote: > > > > > > > > There is a Windows failure that I can't reproduce: > > > > > > > > https://buildkite.com/llvm-project/github-pull-requests/builds/46331 > > > > > > > > Can someone help me to figure out what is wrong? > > > > > > > > > > > > > > > > > > > > > I'm not certain what's going on yet, but it smells a bit like the > > > > > > > interpreter needs to know about sized deallocations now being on > > > > > > > by default (this may be exposing an existing bug rather than > > > > > > > introducing a new one). > > > > > > > CC @vgvassilev > > > > > > > > > > > > > > > > > > I am shooting in the dark here, too. Can you forward declare the > > > > > > new operator delete here: > > > > > > https://github.com/llvm/llvm-project/blob/e2e3624fae669f85de1445bf7037ff29feb30905/clang/lib/Interpreter/Interpreter.cpp#L262 > > > > > > > > > > > > > > > It's still failing. :-( > > > > > > > > > > > > I do not have a platform where I can debug this failure. For some > > > > reason codegen does not emit the symbol for the operator delete. In the > > > > context of #84758, @weliveindetail and @hahnjo were discussing maybe a > > > > related issue. > > > > > > > > > One failure is happening on: > > > ``` > > > Value V3; > > > llvm::cantFail(Interp->ParseAndExecute( > > > "struct S { int* p; S() { p = new int(42); } ~S() { delete p; > > > }};")); > > > llvm::cantFail(Interp->ParseAndExecute("S{}", &V3)); > > > ``` > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > in InterpreterTest.cpp. I'm investigating to see if I can spot what's > > > going wrong because I can reproduce on Windows. > > > > > > The failure happens when executing > > `llvm::cantFail(Interp->ParseAndExecute("S{}", &V3));` specifically. We > > parse the code fine, but execution is what fails. `issueInitLookups()` in > > `GenericLLVMIRPlatformSupport::getInitializers()` is where the failures > > start from, but we get to `Platform::lookupInitSymbols()` and we eventually > > call `failMaterialization()` in `RTDyldObjectLinkingLayer::onObjEmit()` > > when trying to materialize `$.incr_module_33.__inits.0`. > > I'm out of my depth on this, so I may need someone else to help figure this > > out further. > > Can you dump the produced `llvm::Module`s?
This is `T.TheModule` within `Interpreter::Execute()` -- if you mean a different module, let me know which one you're after. ``` ; ModuleID = 'incr_module_33' source_filename = "incr_module_33" target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-windows-msvc19.39.33522" %struct.__clang_Interpreter_NewTag.0 = type { i8 } %struct.S = type { ptr } $"??1S@@QEAA@XZ" = comdat any $"??0S@@QEAA@XZ" = comdat any @"?__ci_newtag@@3U__clang_Interpreter_NewTag@@A" = external dso_local global %struct.__clang_Interpreter_NewTag.0, align 1 @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__sub_I_incr_module_33, ptr null }] @llvm.used = appending global [1 x ptr] [ptr @"??1S@@QEAA@XZ"], section "llvm.metadata" ; Function Attrs: mustprogress noinline nounwind optnone uwtable define linkonce_odr dso_local void @"??1S@@QEAA@XZ"(ptr noundef nonnull align 8 dereferenceable(8) %this) unnamed_addr #0 comdat align 2 { entry: %this.addr = alloca ptr, align 8 store ptr %this, ptr %this.addr, align 8 %this1 = load ptr, ptr %this.addr, align 8 %p = getelementptr inbounds %struct.S, ptr %this1, i32 0, i32 0 %0 = load ptr, ptr %p, align 8 %isnull = icmp eq ptr %0, null br i1 %isnull, label %delete.end, label %delete.notnull delete.notnull: ; preds = %entry call void @"??3@YAXPEAX_K@Z"(ptr noundef %0, i64 noundef 4) #8 br label %delete.end delete.end: ; preds = %delete.notnull, %entry ret void } ; Function Attrs: nobuiltin nounwind declare dso_local void @"??3@YAXPEAX_K@Z"(ptr noundef %0, i64 noundef %1) #1 define internal void @__stmts__0() #2 { entry: %agg.tmp = alloca %struct.__clang_Interpreter_NewTag.0, align 1 %call = call noundef ptr @"?__clang_Interpreter_SetValueWithAlloc@@YAPEAXPEAX00@Z"(ptr noundef inttoptr (i64 1947919581392 to ptr), ptr noundef inttoptr (i64 1947919581448 to ptr), ptr noundef inttoptr (i64 1947920251072 to ptr)) %coerce.dive = getelementptr inbounds %struct.__clang_Interpreter_NewTag.0, ptr %agg.tmp, i32 0, i32 0 %0 = load i8, ptr %coerce.dive, align 1 %call1 = call noundef ptr @"??2@YAPEAX_KPEAXU__clang_Interpreter_NewTag@@@Z"(i64 noundef 8, ptr noundef %call, i8 %0) #9 %new.isnull = icmp eq ptr %call1, null br i1 %new.isnull, label %new.cont, label %new.notnull new.notnull: ; preds = %entry %call2 = call noundef ptr @"??0S@@QEAA@XZ"(ptr noundef nonnull align 8 dereferenceable(8) %call1) br label %new.cont new.cont: ; preds = %new.notnull, %entry %1 = phi ptr [ %call1, %new.notnull ], [ null, %entry ] ret void } declare dso_local noundef ptr @"?__clang_Interpreter_SetValueWithAlloc@@YAPEAXPEAX00@Z"(ptr noundef %0, ptr noundef %1, ptr noundef %2) #3 ; Function Attrs: nounwind declare dso_local noundef ptr @"??2@YAPEAX_KPEAXU__clang_Interpreter_NewTag@@@Z"(i64 noundef %0, ptr noundef %1, i8 %2) #4 ; Function Attrs: mustprogress noinline optnone uwtable define linkonce_odr dso_local noundef ptr @"??0S@@QEAA@XZ"(ptr noundef nonnull returned align 8 dereferenceable(8) %this) unnamed_addr #5 comdat align 2 { entry: %this.addr = alloca ptr, align 8 store ptr %this, ptr %this.addr, align 8 %this1 = load ptr, ptr %this.addr, align 8 %call = call noalias noundef nonnull ptr @"??2@YAPEAX_K@Z"(i64 noundef 4) #10 store i32 42, ptr %call, align 4 %p = getelementptr inbounds %struct.S, ptr %this1, i32 0, i32 0 store ptr %call, ptr %p, align 8 ret ptr %this1 } ; Function Attrs: nobuiltin allocsize(0) declare dso_local noundef nonnull ptr @"??2@YAPEAX_K@Z"(i64 noundef %0) #6 ; Function Attrs: noinline uwtable define internal void @_GLOBAL__sub_I_incr_module_33() #7 { entry: call void @__stmts__0() ret void } attributes #0 = { mustprogress noinline nounwind optnone uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nobuiltin nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { "min-legal-vector-width"="0" } attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { mustprogress noinline optnone uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #6 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #7 = { noinline uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #8 = { builtin nounwind } attributes #9 = { nounwind } attributes #10 = { builtin allocsize(0) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 2} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"uwtable", i32 2} !3 = !{i32 1, !"MaxTLSAlign", i32 65536} !4 = !{!"clang version 19.0.0git (https://github.com/llvm/llvm-project.git 9ed1aa36be654f6687c4f9000c973b722217881c)"} ``` https://github.com/llvm/llvm-project/pull/83774 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits