-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavior
Description
Zig Version
0.16.0-dev.1446+947301105
Steps to Reproduce and Observed Behavior
I'd like to preface this with the fact that this is not an issue that can be triggered with the current upstream compiler. I was experimenting with the powerpc64-ps3(-ilp32) target and extended lib/std/Target.zig:cTypeBitSize with the following prong to get rid of the initial panic when using the target:
.ps3 => switch (c_type) {
.char => return 8,
.short, .ushort => return 16,
.int, .uint, .float, .long, .ulong => return 32,
.longlong, .ulonglong, .double => return 64,
.longdouble => return 128,
},Which matches the clang behavior. Running the patched compiler however crashes due to a segfault:
0x00007fffeb3d1765 in llvm::MachineRegisterInfo::addRegOperandToUseList(llvm::MachineOperand*) () from /usr/lib/libLLVM.so.21.1
#0 0x00007fffeb3d1765 in llvm::MachineRegisterInfo::addRegOperandToUseList(llvm::MachineOperand*) () from /usr/lib/libLLVM.so.21.1
#1 0x00007fffeb31d1f0 in llvm::MachineInstr::addOperand(llvm::MachineFunction&, llvm::MachineOperand const&) () from /usr/lib/libLLVM.so.21.1
#2 0x00007fffef1c3c29 in ?? () from /usr/lib/libLLVM.so.21.1
#3 0x00007fffef1cae7f in ?? () from /usr/lib/libLLVM.so.21.1
#4 0x00007fffeb64de68 in llvm::TargetInstrInfo::lowerCopy(llvm::MachineInstr*, llvm::TargetRegisterInfo const*) const () from /usr/lib/libLLVM.so.21.1
#5 0x00007fffeb184650 in ?? () from /usr/lib/libLLVM.so.21.1
#6 0x00007fffeb18472c in ?? () from /usr/lib/libLLVM.so.21.1
#7 0x00007fffeb310b75 in llvm::MachineFunctionPass::runOnFunction(llvm::Function&) () from /usr/lib/libLLVM.so.21.1
#8 0x00007fffeaf050a3 in llvm::FPPassManager::runOnFunction(llvm::Function&) () from /usr/lib/libLLVM.so.21.1
#9 0x00007fffeaf05283 in llvm::FPPassManager::runOnModule(llvm::Module&) () from /usr/lib/libLLVM.so.21.1
#10 0x00007fffeaf045a2 in llvm::legacy::PassManagerImpl::run(llvm::Module&) () from /usr/lib/libLLVM.so.21.1
#11 0x00000000064c0c40 in ZigLLVMTargetMachineEmitToFile (targ_machine_ref=0x7fff85482050, module_ref=0x7fff841c6cc0, error_message=0x7fff8c41a640, options=0x7fff8c41a790)
at /home/lauree/Developer/zig/src/zig_llvm.cpp:411
#12 0x00000000021fb976 in codegen.llvm.Object.emit (o=0x7fff84002ff8, pt=..., options=...)
#13 0x0000000002033a5c in Compilation.flush (comp=0x7fff84000d20, arena=..., tid=main)
#14 0x0000000001f2788c in Compilation.update (comp=0x7fff84000d20, main_progress_node=...)
#15 0x00000000033aa806 in Compilation.updateSubCompilation (parent_comp=0x6f6b300, sub_comp=0x7fff84000d20, misc_task=compiler_rt, prog_node=...)
#16 0x0000000002d162b4 in Compilation.buildOutputFromZig (comp=0x6f6b300, src_basename=..., root_name=..., output_mode=Lib, link_mode=static, misc_task_tag=compiler_rt, prog_node=..., options=...,
out=0x6f6b950)
#17 0x0000000002883344 in Compilation.buildRt (comp=0x6f6b300, root_source_name=..., root_name=..., output_mode=Lib, link_mode=static, misc_task=compiler_rt, prog_node=..., options=..., out=0x6f6b950)
#18 0x0000000002364211 in Thread.WaitGroup.spawnManager__anon_207123.Manager.run (wg_inner=0x6f6b6c0, args_inner=...)
#19 0x0000000002d1494b in Thread.callFn__anon_326024 (f=<optimized out>, args=...)
#20 0x0000000002882d22 in Thread.PosixThreadImpl.spawn__anon_254921.Instance.entryFn (raw_arg=...)
#21 0x00007ffff7c9698b in start_thread (arg=<optimized out>) at pthread_create.c:448
#22 0x00007ffff7d1a9cc in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
I realize this is probably not a priority issue, given that the target isn't even strictly supported in the compiler, but I thought I'd put it out there and then see if I can get to the bottom of it when I get the time.
Expected Behavior
No segfault.
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavior