Skip to content

stage2/lllvm: panic in lowering maxInt(usize) slice end #14627

@nektro

Description

@nektro

Zig Version

0.11.0-dev.1584+9ccd8ed0a

Steps to Reproduce and Observed Behavior

const std = @import("std");
const arbitrary_max = std.math.maxInt(usize);

test {
    const a = [_]u8{0};
    const b = &a;
    const c: [*]const u8 = b;
    const d = c[0..arbitrary_max];
    _ = d;
}
thread 3988336 panic: integer overflow
/home/meghan/src/zig/src/codegen/llvm.zig:1721:40: 0xf1ed6a in lowerDebugTypeImpl (zig)
                    ty.abiSize(target) * 8,
                                       ^
/home/meghan/src/zig/src/codegen/llvm.zig:1436:36: 0xcb30fd in lowerDebugType (zig)
        return o.lowerDebugTypeImpl(entry, resolve, null);
                                   ^
/home/meghan/src/zig/src/codegen/llvm.zig:1684:65: 0xf1e499 in lowerDebugTypeImpl (zig)
                const elem_di_ty = try o.lowerDebugType(ptr_info.pointee_type, .fwd);
                                                                ^
/home/meghan/src/zig/src/codegen/llvm.zig:1436:36: 0xcb30fd in lowerDebugType (zig)
        return o.lowerDebugTypeImpl(entry, resolve, null);
                                   ^
/home/meghan/src/zig/src/codegen/llvm.zig:1598:59: 0xf1d77b in lowerDebugTypeImpl (zig)
                    const ptr_di_ty = try o.lowerDebugType(bland_ptr_ty, resolve);
                                                          ^
/home/meghan/src/zig/src/codegen/llvm.zig:1436:36: 0xcb30fd in lowerDebugType (zig)
        return o.lowerDebugTypeImpl(entry, resolve, null);
                                   ^
/home/meghan/src/zig/src/codegen/llvm.zig:6175:46: 0x169a7f5 in airDbgVarVal (zig)
            try self.dg.object.lowerDebugType(operand_ty, .full),
                                             ^
/home/meghan/src/zig/src/codegen/llvm.zig:4698:54: 0x114b9f5 in genBody (zig)
                .dbg_var_val => try self.airDbgVarVal(inst),
                                                     ^
/home/meghan/src/zig/src/codegen/llvm.zig:1200:35: 0x11436f6 in updateFunc (zig)
        fg.genBody(air.getMainBody()) catch |err| switch (err) {
                                  ^
/home/meghan/src/zig/src/link/Elf.zig:2451:74: 0x114c34e in updateFunc (zig)
        if (self.llvm_object) |llvm_object| return llvm_object.updateFunc(module, func, air, liveness);
                                                                         ^
/home/meghan/src/zig/src/link.zig:539:77: 0xe9e1de in updateFunc (zig)
            .elf   => return @fieldParentPtr(Elf,   "base", base).updateFunc(module, func, air, liveness),
                                                                            ^
/home/meghan/src/zig/src/Module.zig:4245:37: 0xc5863d in ensureFuncBodyAnalyzed (zig)
            comp.bin_file.updateFunc(mod, func, air, liveness) catch |err| switch (err) {
                                    ^
/home/meghan/src/zig/src/Compilation.zig:3217:42: 0xc55ca5 in processOneJob (zig)
            module.ensureFuncBodyAnalyzed(func) catch |err| switch (err) {
                                         ^
/home/meghan/src/zig/src/Compilation.zig:3155:30: 0xaaf9e7 in performAllTheWork (zig)
            try processOneJob(comp, work_item);
                             ^
/home/meghan/src/zig/src/Compilation.zig:2405:31: 0xaaa68c in update (zig)
    try comp.performAllTheWork(main_progress_node);
                              ^
/home/meghan/src/zig/src/main.zig:3525:20: 0xad2e1d in updateModule (zig)
    try comp.update();
                   ^
/home/meghan/src/zig/src/main.zig:3188:17: 0x9b6a30 in buildOutputType (zig)
    updateModule(gpa, comp, hook) catch |err| switch (err) {
                ^
/home/meghan/src/zig/src/main.zig:269:31: 0x990354 in mainArgs (zig)
        return buildOutputType(gpa, arena, args, .zig_test);
                              ^
/home/meghan/src/zig/src/main.zig:207:20: 0x98f805 in main (zig)
    return mainArgs(gpa, arena, args);
                   ^
/home/meghan/src/zig/lib/std/start.zig:616:37: 0x991ee7 in main (zig)
            const result = root.main() catch |err| {
                                    ^
???:?:?: 0x7f748727d236 in ??? (???)
???:?:?: 0x7fff1bcbce00 in ??? (???)
Aborted (core dumped)

Expected Behavior

all tests passed

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions