Skip to content

Invalid IR emission #59510

@wsmoses

Description

@wsmoses

cc @gbaraldi @vchuravy

see https://gist.github.com/wsmoses/24612bacdde789a9661a708433962ae5

in particular see:

oob:                                              ; preds = %L15
; └
; ┌ @ essentials.jl:917 within `getindex`
   %"+Core.GenericMemoryRef#754" = load ptr, ptr @"+Core.GenericMemoryRef#754", align 8, !dbg !56, !tbaa !27, !invariant.load !0, !alias.scope !34, !noalias !37, !nonnull !0, !dereferenceable !86, !align !62
   %GenericMemoryRef = ptrtoint ptr %"+Core.GenericMemoryRef#754" to i64, !dbg !56
   %149 = inttoptr i64 %GenericMemoryRef to ptr, !dbg !56
   %current_task6 = getelementptr inbounds ptr, ptr %pgcstack, i64 -14, !dbg !56
   %150 = addrspacecast ptr %149 to ptr addrspace(10), !dbg !56
   %"box::GenericMemoryRef" = call noalias nonnull align 8 dereferenceable(16) ptr addrspace(10) @julia.gc_alloc_obj(ptr %current_task6, i64 16, ptr addrspace(10) %150) #10, !dbg !56
   store { ptr, ptr addrspace(10) } %.ref, ptr addrspace(10) %"box::GenericMemoryRef", align 8, !dbg !56, !tbaa !87, !alias.scope !91, !noalias !92
   %151 = addrspacecast ptr addrspace(10) %"box::GenericMemoryRef" to ptr addrspace(12), !dbg !56
   call void @ijl_bounds_error_int(ptr addrspace(12) %151, i64 %"i::Int64"), !dbg !56
   unreachable, !dbg !56

and

   store { ptr, ptr addrspace(10) } %.ref, ptr addrspace(10) %"box::GenericMemoryRef", align 8, !dbg !56, !tbaa !87, !alias.scope !91, !noalias !92

where the store is being done on addrspace 10, not addrspace 11

eventually when this runs through various opt passes, it ends up as

  %.repack35 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(10)* %77, i64 0, i32 1, !dbg !196                                                                                                                                                                                                                                                                                                     

triggering an assertion

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorcompiler:codegenGeneration of LLVM IR and native code

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions