Enzyme.jl icon indicating copy to clipboard operation
Enzyme.jl copied to clipboard

1.12 segfault

Open wsmoses opened this issue 3 weeks ago • 7 comments

using Enzyme
using Test

    Enzyme.API.strictAliasing!(false)
    function f9(x)
        y = []
        foreach(i -> push!(y, i), [1.0, x])
        return first(y)
    end
    @test autodiff(Reverse, f9, Active, Active(2.0))[1][1] == 8

wsmoses avatar Dec 01 '25 02:12 wsmoses

When it doesn't crash I get:

  Expression: ((autodiff(Reverse, f9, Active, Active(2.0)))[1])[1] == 8
   Evaluated: 0.0 == 8

vchuravy avatar Dec 02 '25 09:12 vchuravy

Thread 1 hit Breakpoint 2.1, gc_mark_outrefs (ptls=0x55f8f928d3c0,
    mq=0x55f8f928da00, _new_obj=0x7fac6a6b7e70 <jl_system_image_data+85527600>)
    at /home/vchuravy/src/julia-1.12/src/gc-stock.c:2239
2239	        uintptr_t vtag = o->header & ~(uintptr_t)0xf;
(rr) p new_obj
$2 = (jl_value_t *) 0x7fac6a6b7e70 <jl_system_image_data+85527600>
(rr) p o
$3 = (jl_taggedvalue_t *) 0x7fac6a6b7e68 <jl_system_image_data+85527592>
(rr) watch *(unit64_t**)0x7fac6a6b7e68

Note the $2 holds the object

Later we observe a write:

(rr) p jl_($2)
Array{Any, 1}(dims=(0,), mem=Memory{Any}(0, 0x7fac6a6b7e60)[])
$12 = void
(rr) si

Thread 1 hit Hardware watchpoint 3: *(uint64_t**)0x7fac6a6b7e68

Old value = (uint64_t *) 0x7fac6a745b47 <jl_system_image_data+86108423>
New value = (uint64_t *) 0x7fac61903a90
0x00007fac581e9403 in __safe_setindex! () at array.jl:1008
1008	in array.jl
(rr) p jl_($2)
<?#0x7fac6a6b7e70::Base.RefValue{Float64}(x=0.0000000000000000)>
$13 = void

Meaning that we are corrupting a Julia object by a write to the tag and somehow flip it from a memory to a RefValue

(rr) bt
#0  0x00007fac581e9403 in __safe_setindex! () at array.jl:1008
#1  push! () at array.jl:1297
#2  #f9##0 () at /home/vchuravy/src/Enzyme/2825.jl:7
#3  foreach () at abstractarray.jl:3188
#4  julia_f9_10971 (x=<optimized out>) at /home/vchuravy/src/Enzyme/2825.jl:7
#5  0x00007fac581e9403 in augmented_julia_f9_10971wrap ()
#6  0x00007fac581fdd00 in macro expansion ()
    at /home/vchuravy/src/Enzyme/src/compiler.jl:6534
#7  enzyme_call () at /home/vchuravy/src/Enzyme/src/compiler.jl:6013
#8  AugmentedForwardThunk () at /home/vchuravy/src/Enzyme/src/compiler.jl:5961
#9  autodiff () at /home/vchuravy/src/Enzyme/src/Enzyme.jl:412
#10 julia_autodiff_17095 (mode=..., f=..., args...=...)

vchuravy avatar Dec 02 '25 09:12 vchuravy

Interestingly running under ASAN

vchuravy@loki ~/s/Enzyme (main)> ~/src/julia-1.12-asan/asan/julia -g2 --project=. 2825.jl
Error During Test at /home/vchuravy/src/Enzyme/2825.jl:12
  Test threw exception
  Expression: ((autodiff(Reverse, f9, Active, Active(2.0)))[1])[1] == 8
  EnzymeInternalError: Enzyme compilation failed due to an internal error.
   Please open an issue with the code to reproduce and full error log on github.com/EnzymeAD/Enzyme.jl
   To toggle more information for debugging (needed for bug reports), set Enzyme.Compiler.VERBOSE_ERRORS[] = true (default false)
  Current scope:
  ; Function Attrs: sanitize_address
  define nonnull "enzyme_type"="{[-1]:Pointer}" ptr addrspace(10) @julia_f9_14142(double "enzyme_type"="{[-1]:Float@double}" "enzymejl_parmtype"="140204199356336" "enzymejl_parmtype_ref"="0" "enzymejl_parmtype_str"="Float64" %"x::Float64") local_unnamed_addr #10 !dbg !30 {
  L59:
    %"new::#_growend!##0#_growend!##1" = alloca [9 x i64], align 8
    %0 = alloca ptr addrspace(10), align 8
    %1 = alloca [3 x ptr addrspace(10)], align 8
    %pgcstack = call ptr @julia.get_pgcstack()
    call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %1, i8 0, i64 24, i1 false), !tbaa !24, !alias.scope !42, !noalias !45
    store i64 0, ptr %0, align 8
    call void @llvm.dbg.value(metadata double %"x::Float64", metadata !41, metadata !DIExpression()), !dbg !50
    %current_task = getelementptr inbounds i8, ptr %pgcstack, i64 -152
    %ptls_field = getelementptr inbounds i8, ptr %pgcstack, i64 16
    %ptls_load = load ptr, ptr %ptls_field, align 8, !tbaa !24
    %2 = getelementptr inbounds i8, ptr %ptls_load, i64 16
    %safepoint = load ptr, ptr %2, align 8, !tbaa !28
    fence syncscope("singlethread") seq_cst
    call void @julia.safepoint(ptr %safepoint), !dbg !50
    fence syncscope("singlethread") seq_cst
    %memory_data = load ptr, ptr addrspace(11) getelementptr inbounds (i8, ptr addrspace(11) addrspacecast (ptr addrspace(10) @"ejl_inserted$jl_global_14144$false$140204198775328" to ptr addrspace(11)), i64 8), align 8, !dbg !51, !tbaa !61, !alias.scope !64, !noalias !65, !nonnull !0
    %"new::Array" = call noalias nonnull align 8 dereferenceable(24) "enzyme_ReadOnlyOrThrow" ptr addrspace(10) @julia.gc_alloc_obj(ptr nonnull %current_task, i64 24, ptr addrspace(10) @"ejl_inserted$_Core_Array_14145$false$140204199359760") #18, !dbg !54
    %3 = addrspacecast ptr addrspace(10) %"new::Array" to ptr addrspace(11), !dbg !54
    %4 = getelementptr inbounds i8, ptr addrspace(11) %3, i64 8, !dbg !54
    store ptr %memory_data, ptr addrspace(11) %3, align 8, !dbg !54, !tbaa !66, !alias.scope !64, !noalias !68
    store ptr addrspace(10) @"ejl_inserted$jl_global_14144$false$140204198775328", ptr addrspace(11) %4, align 8, !dbg !54, !tbaa !66, !alias.scope !64, !noalias !68
    %"new::Array.size_ptr" = getelementptr inbounds i8, ptr addrspace(11) %3, i64 16, !dbg !54
    store i64 0, ptr addrspace(11) %"new::Array.size_ptr", align 8, !dbg !54
    %"Memory{Float64}[]" = call noalias nonnull align 16 dereferenceable(32) "enzyme_ReadOnlyOrThrow" ptr addrspace(10) @julia.gc_alloc_obj(ptr nonnull %current_task, i64 32, ptr addrspace(10) @"ejl_inserted$_Core_GenericMemory_14146$false$140204170593760") #19, !dbg !71
    %5 = addrspacecast ptr addrspace(10) %"Memory{Float64}[]" to ptr addrspace(11), !dbg !71
    %memory_ptr = getelementptr inbounds { i64, ptr }, ptr addrspace(11) %5, i64 0, i32 1, !dbg !71
    %6 = call nonnull ptr @julia.pointer_from_objref(ptr addrspace(11) %5) #20, !dbg !71
    %memory_data3 = getelementptr inbounds i8, ptr %6, i64 16, !dbg !71
    store ptr %memory_data3, ptr addrspace(11) %memory_ptr, align 8, !dbg !71, !tbaa !61, !alias.scope !64, !noalias !68
    store i64 2, ptr addrspace(11) %5, align 8, !dbg !71, !tbaa !76, !alias.scope !64, !noalias !68
    %"new::Array9" = call noalias nonnull align 8 dereferenceable(24) "enzyme_ReadOnlyOrThrow" ptr addrspace(10) @julia.gc_alloc_obj(ptr nonnull %current_task, i64 24, ptr addrspace(10) @"ejl_inserted$_Core_Array_14147$false$140204117235568") #18, !dbg !78
    %7 = addrspacecast ptr addrspace(10) %"new::Array9" to ptr addrspace(11), !dbg !78
    %8 = getelementptr inbounds i8, ptr addrspace(11) %7, i64 8, !dbg !78
    store ptr %memory_data3, ptr addrspace(11) %7, align 8, !dbg !78, !tbaa !66, !alias.scope !64, !noalias !68
    store ptr addrspace(10) %"Memory{Float64}[]", ptr addrspace(11) %8, align 8, !dbg !78, !tbaa !66, !alias.scope !64, !noalias !68
    %"new::Array9.size_ptr" = getelementptr inbounds i8, ptr addrspace(11) %7, i64 16, !dbg !78
    store i64 2, ptr addrspace(11) %"new::Array9.size_ptr", align 8, !dbg !78, !tbaa !79, !alias.scope !80, !noalias !81
    %9 = call ptr addrspace(13) @julia.gc_loaded(ptr addrspace(10) %"Memory{Float64}[]", ptr %memory_data3), !dbg !82
    store i64 4607182418800017408, ptr addrspace(13) %9, align 8, !dbg !83, !tbaa !79, !alias.scope !86, !noalias !87
    %memoryref_data12.1 = getelementptr inbounds i8, ptr addrspace(13) %9, i64 8, !dbg !83
    store double %"x::Float64", ptr addrspace(13) %memoryref_data12.1, align 8, !dbg !83, !tbaa !79, !alias.scope !86, !noalias !87
    %10 = getelementptr inbounds i8, ptr %"new::#_growend!##0#_growend!##1", i64 8
    %11 = getelementptr inbounds i8, ptr %"new::#_growend!##0#_growend!##1", i64 16
    %12 = getelementptr inbounds i8, ptr %"new::#_growend!##0#_growend!##1", i64 24
    %13 = getelementptr inbounds i8, ptr %"new::#_growend!##0#_growend!##1", i64 32
    %14 = getelementptr inbounds i8, ptr %"new::#_growend!##0#_growend!##1", i64 40
    %15 = getelementptr inbounds i8, ptr %"new::#_growend!##0#_growend!##1", i64 56
    %16 = getelementptr inbounds i8, ptr %"new::#_growend!##0#_growend!##1", i64 64
    %17 = getelementptr inbounds i8, ptr %1, i64 8
    %18 = getelementptr inbounds i8, ptr %1, i64 16
    %19 = addrspacecast ptr %"new::#_growend!##0#_growend!##1" to ptr addrspace(11)
    br label %L61, !dbg !88

  L61:                                              ; preds = %L117, %L59
    %nodecayed.value_phi31.in = phi ptr addrspace(10)
    %nodecayedoff.value_phi31.in = phi i64
    %value_phi31.in = phi ptr addrspace(13) [ %9, %L59 ], [ %memoryref_data68, %L117 ]
    %value_phi32 = phi i64 [ 2, %L59 ], [ %34, %L117 ]
    %value_phi31 = load double, ptr addrspace(13) %value_phi31.in, align 8, !dbg !91, !tbaa !93, !alias.scope !96, !noalias !97
    %20 = load ptr, ptr addrspace(11) %3, align 8, !dbg !98, !tbaa !66, !alias.scope !64, !noalias !65
    %21 = load ptr addrspace(10), ptr addrspace(11) %4, align 8, !dbg !98, !tbaa !66, !alias.scope !64, !noalias !65, !dereferenceable_or_null !107, !align !108
    %22 = addrspacecast ptr addrspace(10) %21 to ptr addrspace(11), !dbg !109
    %"new::Array.size.0.copyload" = load i64, ptr addrspace(11) %"new::Array.size_ptr", align 8, !dbg !113, !tbaa !79, !alias.scope !115, !noalias !116
    %23 = add i64 %"new::Array.size.0.copyload", 1, !dbg !117
    %memory_data_ptr34 = getelementptr inbounds { i64, ptr }, ptr addrspace(11) %22, i64 0, i32 1, !dbg !121
    %memory_data35 = load ptr, ptr addrspace(11) %memory_data_ptr34, align 8, !dbg !121, !tbaa !61, !alias.scope !64, !noalias !65, !nonnull !0
    %24 = ptrtoint ptr %20 to i64, !dbg !121
    %25 = ptrtoint ptr %memory_data35 to i64, !dbg !121
    %memoryref_offset36 = sub i64 %24, %25, !dbg !121
    %memoryref_offsetidx96 = lshr exact i64 %memoryref_offset36, 3, !dbg !121
    %26 = add nuw nsw i64 %memoryref_offsetidx96, 1, !dbg !121
    store i64 %23, ptr addrspace(11) %"new::Array.size_ptr", align 8, !dbg !122, !tbaa !79, !alias.scope !123, !noalias !116
    %27 = add i64 %26, %"new::Array.size.0.copyload", !dbg !124
    %.unbox = load i64, ptr addrspace(11) %22, align 8, !dbg !127, !tbaa !76, !alias.scope !64, !noalias !65
    %.not97 = icmp slt i64 %.unbox, %27, !dbg !127
    br i1 %.not97, label %L77, label %L80, !dbg !129

  L77:                                              ; preds = %L61
    store i64 %27, ptr %10, align 8, !dbg !130, !tbaa !131, !alias.scope !133, !noalias !134
    store i64 %26, ptr %11, align 8, !dbg !130, !tbaa !131, !alias.scope !133, !noalias !134
    store i64 %23, ptr %12, align 8, !dbg !130, !tbaa !131, !alias.scope !133, !noalias !134
    store i64 %"new::Array.size.0.copyload", ptr %13, align 8, !dbg !130, !tbaa !131, !alias.scope !133, !noalias !134
    %28 = load i64, ptr addrspace(11) %22, align 8, !dbg !130, !tbaa !79, !alias.scope !115, !noalias !116
    store i64 %28, ptr %14, align 8, !dbg !130, !tbaa !79, !alias.scope !115, !noalias !116
    store ptr %20, ptr %15, align 8, !dbg !130, !noalias !135
    store i64 -1, ptr %16, align 8, !dbg !130, !tbaa !131, !alias.scope !133, !noalias !134
    store ptr addrspace(10) %"new::Array", ptr %1, align 8, !dbg !130, !noalias !135
    store ptr addrspace(10) %21, ptr %17, align 8, !dbg !130, !noalias !135
    store ptr addrspace(10) %21, ptr %18, align 8, !dbg !130, !noalias !135
    call fastcc void @julia___growend___0_14159(ptr noalias nocapture noundef "enzymejl_returnRoots"="1" %0, ptr addrspace(11) nocapture readonly %19, ptr nocapture nonnull readonly %1), !dbg !130
    br label %L80, !dbg !130

  L80:                                              ; preds = %L61, %L77
    %"new::Array.size40.0.copyload" = load i64, ptr addrspace(11) %"new::Array.size_ptr", align 8, !dbg !136, !tbaa !79, !alias.scope !115, !noalias !116
    %memoryref_data42 = load ptr, ptr addrspace(11) %3, align 8, !dbg !138, !tbaa !66, !alias.scope !64, !noalias !65
    %memoryref_mem51 = load ptr addrspace(10), ptr addrspace(11) %4, align 8, !dbg !138, !tbaa !66, !alias.scope !64, !noalias !65, !dereferenceable_or_null !107, !align !108
    %memoryref_offset44 = shl i64 %"new::Array.size40.0.copyload", 3, !dbg !139
    %29 = call ptr addrspace(13) @julia.gc_loaded(ptr addrspace(10) %memoryref_mem51, ptr %memoryref_data42), !dbg !139
    %30 = getelementptr i8, ptr addrspace(13) %29, i64 %memoryref_offset44, !dbg !139
    %memoryref_data50 = getelementptr i8, ptr addrspace(13) %30, i64 -8, !dbg !139
    %"box::Float64" = call noalias nonnull align 8 dereferenceable(8) "enzyme_ReadOnlyOrThrow" ptr addrspace(10) @julia.gc_alloc_obj(ptr nonnull %current_task, i64 8, ptr addrspace(10) @"ejl_inserted$_Core_Float64_14149$false$140204199356336") #18, !dbg !139
    %31 = addrspacecast ptr addrspace(10) %"box::Float64" to ptr addrspace(11), !dbg !139
    store double %value_phi31, ptr addrspace(11) %31, align 8, !dbg !139, !tbaa !140, !alias.scope !96, !noalias !143
    store atomic ptr addrspace(10) %"box::Float64", ptr addrspace(13) %memoryref_data50 release, align 8, !dbg !139, !tbaa !144, !alias.scope !96, !noalias !143
    call void (ptr addrspace(10), ...) @julia.write_barrier(ptr addrspace(10) nonnull %memoryref_mem51, ptr addrspace(10) nonnull %"box::Float64"), !dbg !139
    %32 = add i64 %value_phi32, -1, !dbg !146
    %"new::Array9.size54.0.copyload" = load i64, ptr addrspace(11) %"new::Array9.size_ptr", align 8, !dbg !147, !tbaa !79, !alias.scope !115, !noalias !116
    %.not98.not = icmp ult i64 %32, %"new::Array9.size54.0.copyload", !dbg !148
    br i1 %.not98.not, label %L117, label %L126, !dbg !91

  L117:                                             ; preds = %L80
    %memoryref_data60 = load ptr, ptr addrspace(11) %7, align 8, !dbg !149, !tbaa !66, !alias.scope !64, !noalias !65
    %memoryref_mem66 = load ptr addrspace(10), ptr addrspace(11) %8, align 8, !dbg !149, !tbaa !66, !alias.scope !64, !noalias !65, !dereferenceable_or_null !107, !align !108
    %memoryref_byteoffset63 = shl i64 %32, 3, !dbg !149
    %33 = call ptr addrspace(13) @julia.gc_loaded(ptr addrspace(10) %memoryref_mem66, ptr %memoryref_data60), !dbg !149
    %memoryref_data68 = getelementptr inbounds i8, ptr addrspace(13) %33, i64 %memoryref_byteoffset63, !dbg !149
    %34 = add i64 %value_phi32, 1, !dbg !151
    br label %L61

  L126:                                             ; preds = %L80
    %"new::Array.size73.0.copyload" = load i64, ptr addrspace(11) %"new::Array.size_ptr", align 8, !dbg !152, !tbaa !79, !alias.scope !115, !noalias !116
    %.not99 = icmp eq i64 %"new::Array.size73.0.copyload", 0, !dbg !153
    br i1 %.not99, label %L135, label %L138, !dbg !153

  L135:                                             ; preds = %L126
    call fastcc void @julia_throw_boundserror_14152(ptr addrspace(10) %"new::Array") #21, !dbg !153
    unreachable, !dbg !153

  L138:                                             ; preds = %L126
    %memoryref_data76 = load ptr, ptr addrspace(11) %3, align 8, !dbg !157, !tbaa !66, !alias.scope !64, !noalias !65
    %memoryref_mem80 = load ptr addrspace(10), ptr addrspace(11) %4, align 8, !dbg !157, !tbaa !66, !alias.scope !64, !noalias !65, !dereferenceable_or_null !107, !align !108
    %memoryref_data82 = call ptr addrspace(13) @julia.gc_loaded(ptr addrspace(10) %memoryref_mem80, ptr %memoryref_data76), !dbg !157
    %35 = load atomic ptr addrspace(10), ptr addrspace(13) %memoryref_data82 unordered, align 8, !dbg !157, !tbaa !144, !alias.scope !96, !noalias !97
    %.not100 = icmp eq ptr addrspace(10) %35, null, !dbg !157
    br i1 %.not100, label %fail, label %pass, !dbg !157

  fail:                                             ; preds = %L138
    %jl_undefref_exception = load ptr, ptr @jl_undefref_exception, align 8, !dbg !157, !tbaa !28, !alias.scope !158, !noalias !159, !nonnull !0
    %36 = addrspacecast ptr %jl_undefref_exception to ptr addrspace(12), !dbg !157
    call void @ijl_throw(ptr addrspace(12) %36), !dbg !157
    unreachable, !dbg !157

  pass:                                             ; preds = %L138
    ret ptr addrspace(10) %35, !dbg !156
  }

  Could not analyze garbage collection behavior of
   inst:   %value_phi31.in = phi ptr addrspace(13) [ %9, %L59 ], [ %memoryref_data68, %L117 ]
   v0:   %9 = call ptr addrspace(13) @julia.gc_loaded(ptr addrspace(10) %"Memory{Float64}[]", ptr %memory_data3), !dbg !70
   v:   %6 = call nonnull ptr @julia.pointer_from_objref(ptr addrspace(11) %5) #20, !dbg !59
   offset: i64 0
   hasload: false



  Stacktrace:
    [1] (::Enzyme.Compiler.var"#getparent#nodecayed_phis!##0"{LLVM.Context, LLVM.Function, LLVM.IntegerType, Int64, Dict{LLVM.PHIInst, LLVM.PHIInst}, Dict{LLVM.PHIInst, LLVM.PHIInst}, LLVM.PHIInst, LLVM.CallInst})(b::LLVM.IRBuilder, v::LLVM.Value, offset::LLVM.Value, hasload::Bool, phicache::Dict{LLVM.PHIInst, Tuple{LLVM.PHIInst, LLVM.PHIInst}})
      @ Enzyme.Compiler ~/src/Enzyme/src/llvm/transforms.jl:1045
    [2] (::Enzyme.Compiler.var"#getparent#nodecayed_phis!##0"{LLVM.Context, LLVM.Function, LLVM.IntegerType, Int64, Dict{LLVM.PHIInst, LLVM.PHIInst}, Dict{LLVM.PHIInst, LLVM.PHIInst}, LLVM.PHIInst, LLVM.CallInst})(b::LLVM.IRBuilder, v::LLVM.Value, offset::LLVM.Value, hasload::Bool, phicache::Dict{LLVM.PHIInst, Tuple{LLVM.PHIInst, LLVM.PHIInst}})
      @ Enzyme.Compiler ~/src/Enzyme/src/llvm/transforms.jl:913
    [3] (::Enzyme.Compiler.var"#getparent#nodecayed_phis!##0"{LLVM.Context, LLVM.Function, LLVM.IntegerType, Int64, Dict{LLVM.PHIInst, LLVM.PHIInst}, Dict{LLVM.PHIInst, LLVM.PHIInst}, LLVM.PHIInst, LLVM.CallInst})(b::LLVM.IRBuilder, v::LLVM.Value, offset::LLVM.Value, hasload::Bool, phicache::Dict{LLVM.PHIInst, Tuple{LLVM.PHIInst, LLVM.PHIInst}})
      @ Enzyme.Compiler ~/src/Enzyme/src/llvm/transforms.jl:720
    [4] nodecayed_phis!(mod::LLVM.Module)
      @ Enzyme.Compiler ~/src/Enzyme/src/llvm/transforms.jl:1052
    [5] optimize!(mod::LLVM.Module, tm::LLVM.TargetMachine)
      @ Enzyme.Compiler ~/src/Enzyme/src/compiler/optimize.jl:196
    [6] compile_unhooked(output::Symbol, job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget{GPUCompiler.NativeCompilerTarget}, Enzyme.Compiler.EnzymeCompilerParams{Enzyme.Compiler.PrimalCompilerParams}})
      @ Enzyme.Compiler ~/src/Enzyme/src/compiler.jl:5336
    [7] compile(target::Symbol, job::GPUCompiler.CompilerJob; kwargs::@Kwargs{})
      @ GPUCompiler ~/.julia/packages/GPUCompiler/j4HFa/src/driver.jl:67
    [8] compile
      @ ~/.julia/packages/GPUCompiler/j4HFa/src/driver.jl:55 [inlined]
    [9] _thunk(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget{GPUCompiler.NativeCompilerTarget}, Enzyme.Compiler.EnzymeCompilerParams{Enzyme.Compiler.PrimalCompilerParams}}, postopt::Bool)
      @ Enzyme.Compiler ~/src/Enzyme/src/compiler.jl:6607
   [10] _thunk
      @ ~/src/Enzyme/src/compiler.jl:6605 [inlined]
   [11] cached_compilation
      @ ~/src/Enzyme/src/compiler.jl:6663 [inlined]
   [12] thunkbase(mi::Core.MethodInstance, World::UInt64, FA::Type{<:Annotation}, A::Type{<:Annotation}, TT::Type, Mode::Enzyme.API.CDerivativeMode, width::Int64, ModifiedBetween::NTuple{N, Bool} where N, ReturnPrimal::Bool, ShadowInit::Bool, ABI::Type, ErrIfFuncWritten::Bool, RuntimeActivity::Bool, StrongZero::Bool, edges::Vector{Any})
      @ Enzyme.Compiler ~/src/Enzyme/src/compiler.jl:6779
   [13] thunk_generator(world::UInt64, source::Union{LineNumberNode, Method}, FA::Type, A::Type, TT::Type, Mode::Enzyme.API.CDerivativeMode, Width::Int64, ModifiedBetween::NTuple{N, Bool} where N, ReturnPrimal::Bool, ShadowInit::Bool, ABI::Type, ErrIfFuncWritten::Bool, RuntimeActivity::Bool, StrongZero::Bool, self::Any, fakeworld::Any, fa::Type, a::Type, tt::Type, mode::Type, width::Type, modifiedbetween::Type, returnprimal::Type, shadowinit::Type, abi::Type, erriffuncwritten::Type, runtimeactivity::Type, strongzero::Type)
      @ Enzyme.Compiler ~/src/Enzyme/src/compiler.jl:6923
   [14] autodiff_thunk
      @ ~/src/Enzyme/src/Enzyme.jl:1001 [inlined]
   [15] autodiff
      @ ~/src/Enzyme/src/Enzyme.jl:395 [inlined]
   [16] autodiff(mode::ReverseMode{false, false, false, FFIABI, false, false}, f::typeof(f9), ::Type{Active}, args::Active{Float64})
      @ Enzyme ~/src/Enzyme/src/Enzyme.jl:542
   [17] autodiff(mode::ReverseMode{false, false, false, FFIABI, false, false}, f::typeof(f9), ::Type{Active}, args::Active{Float64})
      @ Enzyme :0
   [18] top-level scope
      @ ~/src/Enzyme/2825.jl:516
   [19] macro expansion
      @ ~/src/julia-1.12-asan/asan/usr/share/julia/stdlib/v1.12/Test/src/Test.jl:677 [inlined]
ERROR: LoadError: There was an error during testing
in expression starting at /home/vchuravy/src/Enzyme/2825.jl:12

vchuravy avatar Dec 02 '25 12:12 vchuravy

er, wat

wsmoses avatar Dec 02 '25 20:12 wsmoses

are we non determinstically compiling?

wsmoses avatar Dec 02 '25 20:12 wsmoses

and/or what does the Enzyme.API.printall!(true) of the two look like, does it differ?

wsmoses avatar Dec 02 '25 20:12 wsmoses

ASAN changed the way object are laid out in memory and so the corruption memory write goes somewhere else and doesn't cause the GC crash

vchuravy avatar Dec 03 '25 12:12 vchuravy