[llvm-bugs] [Bug 34726] New: [X86][MC] Crash when assembling file containing section with 64-bit alignment

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 25 17:44:20 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=34726

            Bug ID: 34726
           Summary: [X86][MC] Crash when assembling file containing
                    section with 64-bit alignment
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: konstantin.belochapka at sony.com
                CC: llvm-bugs at lists.llvm.org

the clang assembler crashes when passed the attached assembly
file which contains the following lines:

        .text
        .align 0x100000000, 0x90
        mov     %rax,%rbx
        .data
        .align 0x200000000, 0x90
        mov     %rsi, %rdi


$ clang -c source1.s
clang-6.0: /llvm/include/llvm/Support/MathExtras.h:678: uint64_t
llvm::alignTo(uint64_t, uint64_t, uint64_t): Assertion `Align != 0u && "Align
can't be 0."' failed.
#0 0x0000000003bbf9bf llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/llvm/lib/Support/Unix/Signals.inc:398:0
#1 0x0000000003bbfa52 PrintStackTraceSignalHandler(void*)
/llvm/lib/Support/Unix/Signals.inc:462:0
#2 0x0000000003bbdc2d llvm::sys::RunSignalHandlers()
/llvm/lib/Support/Signals.cpp:49:0
#3 0x0000000003bbf22b SignalHandler(int)
/llvm/lib/Support/Unix/Signals.inc:252:0
#4 0x00007f3073987390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#5 0x00007f30726f2428 gsignal
/build/glibc-bfm8X4/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#6 0x00007f30726f402a abort /build/glibc-bfm8X4/glibc-2.23/stdlib/abort.c:91:0
#7 0x00007f30726eabd7 __assert_fail_base
/build/glibc-bfm8X4/glibc-2.23/assert/assert.c:92:0
#8 0x00007f30726eac82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#9 0x0000000001ae5441 llvm::alignTo(unsigned long, unsigned long, unsigned
long) /llvm/include/llvm/Support/MathExtras.h:679:0
#10 0x00000000020d4e07 llvm::OffsetToAlignment(unsigned long, unsigned long)
/llvm/include/llvm/Support/MathExtras.h:720:0
#11 0x0000000003782555 llvm::MCAssembler::computeFragmentSize(llvm::MCAsmLayout
const&, llvm::MCFragment const&) const
/data/projects/BUGS/38096/llvm/lib/MC/MCAssembler.cpp:292:0
#12 0x0000000003782bad llvm::MCAsmLayout::layoutFragment(llvm::MCFragment*)
/llvm/lib/MC/MCAssembler.cpp:362:0
#13 0x00000000037bc5bc llvm::MCAsmLayout::ensureValid(llvm::MCFragment const*)
const /llvm/lib/MC/MCFragment.cpp:73:0
#14 0x00000000037bc607 llvm::MCAsmLayout::getFragmentOffset(llvm::MCFragment
const*) const /llvm/lib/MC/MCFragment.cpp:79:0
#15 0x00000000037859bd llvm::MCAssembler::finishLayout(llvm::MCAsmLayout&)
/llvm/lib/MC/MCAssembler.cpp:955:0
#16 0x0000000003784411 llvm::MCAssembler::layout(llvm::MCAsmLayout&)
/llvm/lib/MC/MCAssembler.cpp:704:0
#17 0x00000000037849d1 llvm::MCAssembler::Finish()
/llvm/lib/MC/MCAssembler.cpp:755:0
#18 0x00000000037d0f54 llvm::MCObjectStreamer::FinishImpl()
/llvm/lib/MC/MCObjectStreamer.cpp:608:0
#19 0x00000000037b3bcd llvm::MCELFStreamer::FinishImpl()
/llvm/lib/MC/MCELFStreamer.cpp:621:0
#20 0x00000000037d9aac llvm::MCStreamer::Finish()
/llvm/lib/MC/MCStreamer.cpp:748:0
#21 0x0000000003805208 (anonymous namespace)::AsmParser::Run(bool, bool)
/llvm/lib/MC/MCParser/AsmParser.cpp:961:0
#22 0x0000000001ac966f ExecuteAssembler((anonymous
namespace)::AssemblerInvocation&, clang::DiagnosticsEngine&)
/llvm/tools/clang/tools/driver/cc1as_main.cpp:453:0
#23 0x0000000001ac9e28 cc1as_main(llvm::ArrayRef<char const*>, char const*,
void*) /llvm/tools/clang/tools/driver/cc1as_main.cpp:534:0
#24 0x0000000001ab5346 ExecuteCC1Tool(llvm::ArrayRef<char const*>,
llvm::StringRef) /llvm/tools/clang/tools/driver/driver.cpp:304:0
#25 0x0000000001ab5ec1 main /llvm/tools/clang/tools/driver/driver.cpp:381:0
#26 0x00007f30726dd830 __libc_start_main
/build/glibc-bfm8X4/glibc-2.23/csu/../csu/libc-start.c:325:0
#27 0x0000000001ab2939 _start (/llvm-build/r313400/bin/clang-6.0+0x1ab2939)
Stack dump:
0.      Program arguments: /llvm-build/r313400/bin/clang-6.0 -cc1as -triple
x86_64-unknown-linux-gnu -filetype obj -main-file-name source1.s -target-cpu
x86-64 -fdebug-compilation-dir /70046 -dwarf-debug-producer clang version 6.0.0
(trunk 313400) -dwarf-version=4 -mrelocation-model static -o source1.o
source1.s
clang-6.0: error: unable to execute command: Aborted (core dumped)
clang-6.0: error: clang integrated assembler command failed due to signal (use
-v to see invocation)
clang version 6.0.0 (trunk 313400)


This is reproducible on all clang versions.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170926/0f1e3b6b/attachment.html>


More information about the llvm-bugs mailing list