Jun Koi
2015-Jul-28 16:17 UTC
[LLVMdev] Wrong encoding/decoding for POPC instruction of Sparc
Hello, There is an issue in the latest Sparc code: while we can encode POPC, decode results in crash in llvm-mc $ echo "popc %g1, %g2" | ./Release+Asserts/bin/llvm-mc -assemble -triple=sparcv9 -show-encoding .text popc %g1, %g2 ! encoding: [0x85,0x70,0x00,0x01] $ echo "0x85,0x70,0x00,0x01"|./Release+Asserts/bin/llvm-mc -disassemble -triple=sparcv9 .text popc Assertion failed: (idx < size()), function operator[], file /Users/jun/projects/llvm/sparc-2.git/include/llvm/ADT/SmallVector.h, line 143. 0 llvm-mc 0x00000001096a5099 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 57 1 llvm-mc 0x00000001096a45c6 llvm::sys::RunSignalHandlers() + 102 2 llvm-mc 0x00000001096a5b95 SignalHandler(int) + 693 3 libsystem_platform.dylib 0x00007fff86d78f1a _sigtramp + 26 4 libsystem_platform.dylib 0x0000000000000002 _sigtramp + 2032693506 5 llvm-mc 0x00000001096a5836 abort + 22 6 llvm-mc 0x00000001096a5811 __assert_rtn + 81 7 llvm-mc 0x000000010963f4e8 llvm::SparcInstPrinter::printOperand(llvm::MCInst const*, int, llvm::MCSubtargetInfo const&, llvm::raw_ostream&) + 136 8 llvm-mc 0x000000010963eae0 llvm::SparcInstPrinter::printInstruction(llvm::MCInst const*, llvm::MCSubtargetInfo const&, llvm::raw_ostream&) + 256 9 llvm-mc 0x000000010964f5e6 llvm::SparcInstPrinter::printInst(llvm::MCInst const*, llvm::raw_ostream&, llvm::StringRef, llvm::MCSubtargetInfo const&) + 86 10 llvm-mc 0x000000010965f90f (anonymous namespace)::MCAsmStreamer::EmitInstruction(llvm::MCInst const&, llvm::MCSubtargetInfo const&) + 2879 11 llvm-mc 0x00000001096043b3 llvm::Disassembler::disassemble(llvm::Target const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, llvm::MCSubtargetInfo&, llvm::MCStreamer&, llvm::MemoryBuffer&, llvm::SourceMgr&, llvm::raw_ostream&) + 2147 12 llvm-mc 0x0000000109607460 main + 9760 13 libdyld.dylib 0x00007fff8f34d5c9 start + 1 14 libdyld.dylib 0x0000000000000003 start + 1892362811 Stack dump: 0. Program arguments: ./Release+Asserts/bin/llvm-mc -disassemble -triple=sparcv9 Illegal instruction: 4 Any ideas on what is wrong, and how to fix this? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150729/f3edbc53/attachment.html>
Jun Koi
2015-Jul-31 03:01 UTC
[LLVMdev] Wrong encoding/decoding for POPC instruction of Sparc
Any ideas on this bug? Thanks. On Wed, Jul 29, 2015 at 12:17 AM, Jun Koi <junkoi2004 at gmail.com> wrote:> Hello, > > There is an issue in the latest Sparc code: while we can encode POPC, > decode results in crash in llvm-mc > > $ echo "popc %g1, %g2" | ./Release+Asserts/bin/llvm-mc -assemble > -triple=sparcv9 -show-encoding > .text > popc %g1, %g2 ! encoding: [0x85,0x70,0x00,0x01] > > $ echo "0x85,0x70,0x00,0x01"|./Release+Asserts/bin/llvm-mc -disassemble > -triple=sparcv9 > .text > popc Assertion failed: (idx < size()), function operator[], file > /Users/jun/projects/llvm/sparc-2.git/include/llvm/ADT/SmallVector.h, line > 143. > 0 llvm-mc 0x00000001096a5099 > llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 57 > 1 llvm-mc 0x00000001096a45c6 > llvm::sys::RunSignalHandlers() + 102 > 2 llvm-mc 0x00000001096a5b95 SignalHandler(int) + 693 > 3 libsystem_platform.dylib 0x00007fff86d78f1a _sigtramp + 26 > 4 libsystem_platform.dylib 0x0000000000000002 _sigtramp + 2032693506 > 5 llvm-mc 0x00000001096a5836 abort + 22 > 6 llvm-mc 0x00000001096a5811 __assert_rtn + 81 > 7 llvm-mc 0x000000010963f4e8 > llvm::SparcInstPrinter::printOperand(llvm::MCInst const*, int, > llvm::MCSubtargetInfo const&, llvm::raw_ostream&) + 136 > 8 llvm-mc 0x000000010963eae0 > llvm::SparcInstPrinter::printInstruction(llvm::MCInst const*, > llvm::MCSubtargetInfo const&, llvm::raw_ostream&) + 256 > 9 llvm-mc 0x000000010964f5e6 > llvm::SparcInstPrinter::printInst(llvm::MCInst const*, llvm::raw_ostream&, > llvm::StringRef, llvm::MCSubtargetInfo const&) + 86 > 10 llvm-mc 0x000000010965f90f (anonymous > namespace)::MCAsmStreamer::EmitInstruction(llvm::MCInst const&, > llvm::MCSubtargetInfo const&) + 2879 > 11 llvm-mc 0x00000001096043b3 > llvm::Disassembler::disassemble(llvm::Target const&, > std::__1::basic_string<char, std::__1::char_traits<char>, > std::__1::allocator<char> > const&, llvm::MCSubtargetInfo&, > llvm::MCStreamer&, llvm::MemoryBuffer&, llvm::SourceMgr&, > llvm::raw_ostream&) + 2147 > 12 llvm-mc 0x0000000109607460 main + 9760 > 13 libdyld.dylib 0x00007fff8f34d5c9 start + 1 > 14 libdyld.dylib 0x0000000000000003 start + 1892362811 > Stack dump: > 0. Program arguments: ./Release+Asserts/bin/llvm-mc -disassemble > -triple=sparcv9 > Illegal instruction: 4 > > > Any ideas on what is wrong, and how to fix this? > > > Thank you. >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150731/b28366a0/attachment.html>
James Y Knight
2015-Jul-31 14:56 UTC
[LLVMdev] Wrong encoding/decoding for POPC instruction of Sparc
I'll look into it, thanks for the report. On Thu, Jul 30, 2015 at 11:01 PM, Jun Koi <junkoi2004 at gmail.com> wrote:> Any ideas on this bug? > > Thanks. > > > On Wed, Jul 29, 2015 at 12:17 AM, Jun Koi <junkoi2004 at gmail.com> wrote: > >> Hello, >> >> There is an issue in the latest Sparc code: while we can encode POPC, >> decode results in crash in llvm-mc >> >> $ echo "popc %g1, %g2" | ./Release+Asserts/bin/llvm-mc -assemble >> -triple=sparcv9 -show-encoding >> .text >> popc %g1, %g2 ! encoding: [0x85,0x70,0x00,0x01] >> >> $ echo "0x85,0x70,0x00,0x01"|./Release+Asserts/bin/llvm-mc -disassemble >> -triple=sparcv9 >> .text >> popc Assertion failed: (idx < size()), function operator[], file >> /Users/jun/projects/llvm/sparc-2.git/include/llvm/ADT/SmallVector.h, line >> 143. >> 0 llvm-mc 0x00000001096a5099 >> llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 57 >> 1 llvm-mc 0x00000001096a45c6 >> llvm::sys::RunSignalHandlers() + 102 >> 2 llvm-mc 0x00000001096a5b95 SignalHandler(int) + 693 >> 3 libsystem_platform.dylib 0x00007fff86d78f1a _sigtramp + 26 >> 4 libsystem_platform.dylib 0x0000000000000002 _sigtramp + 2032693506 >> 5 llvm-mc 0x00000001096a5836 abort + 22 >> 6 llvm-mc 0x00000001096a5811 __assert_rtn + 81 >> 7 llvm-mc 0x000000010963f4e8 >> llvm::SparcInstPrinter::printOperand(llvm::MCInst const*, int, >> llvm::MCSubtargetInfo const&, llvm::raw_ostream&) + 136 >> 8 llvm-mc 0x000000010963eae0 >> llvm::SparcInstPrinter::printInstruction(llvm::MCInst const*, >> llvm::MCSubtargetInfo const&, llvm::raw_ostream&) + 256 >> 9 llvm-mc 0x000000010964f5e6 >> llvm::SparcInstPrinter::printInst(llvm::MCInst const*, llvm::raw_ostream&, >> llvm::StringRef, llvm::MCSubtargetInfo const&) + 86 >> 10 llvm-mc 0x000000010965f90f (anonymous >> namespace)::MCAsmStreamer::EmitInstruction(llvm::MCInst const&, >> llvm::MCSubtargetInfo const&) + 2879 >> 11 llvm-mc 0x00000001096043b3 >> llvm::Disassembler::disassemble(llvm::Target const&, >> std::__1::basic_string<char, std::__1::char_traits<char>, >> std::__1::allocator<char> > const&, llvm::MCSubtargetInfo&, >> llvm::MCStreamer&, llvm::MemoryBuffer&, llvm::SourceMgr&, >> llvm::raw_ostream&) + 2147 >> 12 llvm-mc 0x0000000109607460 main + 9760 >> 13 libdyld.dylib 0x00007fff8f34d5c9 start + 1 >> 14 libdyld.dylib 0x0000000000000003 start + 1892362811 >> Stack dump: >> 0. Program arguments: ./Release+Asserts/bin/llvm-mc -disassemble >> -triple=sparcv9 >> Illegal instruction: 4 >> >> >> Any ideas on what is wrong, and how to fix this? >> >> >> Thank you. >> > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150731/df02d7ba/attachment.html>
Possibly Parallel Threads
- [LLVMdev] Wrong encoding/decoding for POPC instruction of Sparc
- [LLVMdev] Wrong encoding/decoding for POPC instruction of Sparc
- [LLVMdev] Wrong encoding/decoding for POPC instruction of Sparc
- Comparing matrices
- [LLVMdev] [MC] [llvm-mc] Getting target specific information to <target>ELFObjectWriter