New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion `(isUIntN(8 * Size, Value) || isIntN(8 * Size, Value)) && "Invalid size"' #898

Closed
bnoordhuis opened this Issue Apr 5, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@bnoordhuis
Member

bnoordhuis commented Apr 5, 2018

With master and release_60 from llvm+clang git.

$ gdb --args ./zig test /home/bnoordhuis/src/zig/std/index.zig --target-arch x86_64 --target-os windows --target-environ msvc --test-name-prefix std-windows-x86_64-Debug-bare
Reading symbols from ./zig...done.
(gdb) r
Starting program: /home/bnoordhuis/src/zig/build/zig test /home/bnoordhuis/src/zig/std/index.zig --target-arch x86_64 --target-os windows --target-environ msvc --test-name-prefix std-windows-x86_64-Debug-bare
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
zig: /home/bnoordhuis/src/llvm/lib/MC/MCStreamer.cpp:113: virtual void llvm::MCStreamer::EmitIntValue(uint64_t, unsigned int): Assertion `(isUIntN(8 * Size, Value) || isIntN(8 * Size, Value)) && "Invalid size"' failed.

Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007fffec6d0f5d in __GI_abort () at abort.c:90
#2  0x00007fffec6c6f17 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x7fffee149cd8 "(isUIntN(8 * Size, Value) || isIntN(8 * Size, Value)) && \"Invalid size\"", file=file@entry=0x7fffee149c38 "/home/bnoordhuis/src/llvm/lib/MC/MCStreamer.cpp", line=line@entry=113, function=function@entry=0x7fffee14b100 <llvm::MCStreamer::EmitIntValue(unsigned long, unsigned int)::__PRETTY_FUNCTION__> "virtual void llvm::MCStreamer::EmitIntValue(uint64_t, unsigned int)") at assert.c:92
#3  0x00007fffec6c6fc2 in __GI___assert_fail (assertion=assertion@entry=0x7fffee149cd8 "(isUIntN(8 * Size, Value) || isIntN(8 * Size, Value)) && \"Invalid size\"", file=file@entry=0x7fffee149c38 "/home/bnoordhuis/src/llvm/lib/MC/MCStreamer.cpp", line=line@entry=113, function=function@entry=0x7fffee14b100 <llvm::MCStreamer::EmitIntValue(unsigned long, unsigned int)::__PRETTY_FUNCTION__> "virtual void llvm::MCStreamer::EmitIntValue(uint64_t, unsigned int)") at assert.c:101
#4  0x00007fffee103b3b in llvm::MCStreamer::EmitIntValue (this=<optimized out>, Value=<optimized out>, Size=<optimized out>) at /home/bnoordhuis/src/llvm/lib/MC/MCStreamer.cpp:112
#5  0x00007fffe8b0a684 in llvm::CodeViewDebug::emitCompilerInformation (this=this@entry=0x55556ed293e0) at /home/bnoordhuis/src/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:701
#6  0x00007fffe8b1e997 in llvm::CodeViewDebug::endModule (this=0x55556ed293e0) at /home/bnoordhuis/src/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:458
#7  0x00007fffe8ab50e2 in llvm::AsmPrinter::doFinalization (this=0x555563ad7890, M=...) at /home/bnoordhuis/src/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1338
#8  0x00007fffedc70c93 in llvm::FPPassManager::doFinalization (this=0x55556ec4a0b0, M=...) at /home/bnoordhuis/src/llvm/lib/IR/LegacyPassManager.cpp:1559
#9  0x00007fffedc7ace5 in (anonymous namespace)::MPPassManager::runOnModule (M=..., this=<optimized out>) at /home/bnoordhuis/src/llvm/lib/IR/LegacyPassManager.cpp:1615
#10 llvm::legacy::PassManagerImpl::run (this=0x55556469aa50, M=...) at /home/bnoordhuis/src/llvm/lib/IR/LegacyPassManager.cpp:1700
#11 0x0000555555b84957 in ZigLLVMTargetMachineEmitToFile (targ_machine_ref=0x5555564b53b0, module_ref=0x5555564b2f40, filename=0x55556ee684c0 "./zig-cache/test.obj", output_type=ZigLLVM_EmitBinary, error_message=0x7fffffffd550, is_debug=true) at /home/bnoordhuis/src/zig/src/zig_llvm.cpp:177
#12 0x0000555555af75bc in do_code_gen (g=0x5555564a9550) at /home/bnoordhuis/src/zig/src/codegen.cpp:5524
#13 0x0000555555afcbe1 in codegen_build (g=0x5555564a9550) at /home/bnoordhuis/src/zig/src/codegen.cpp:6917
#14 0x0000555555b59a6f in main (argc=11, argv=0x7fffffffdd28) at /home/bnoordhuis/src/zig/src/main.cpp:936

I'm reasonably sure it's because llvm misparses the git sha in zig's version string.

bnoordhuis added a commit to bnoordhuis/zig that referenced this issue Apr 5, 2018

fix llvm assert on version string with git sha
LLVM's CodeViewDebug pass misparses the version string when it contains
a git revision so stop doing that.  This only affected Windows builds.

closes ziglang#898

@bnoordhuis bnoordhuis added the bug label Apr 5, 2018

@bnoordhuis bnoordhuis added this to the 0.3.0 milestone Apr 5, 2018

@andrewrk andrewrk closed this in #899 Apr 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment