<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55273>55273</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Failed assertion on incorrect .align value in an asm statement
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
AaronBallman
</td>
</tr>
</table>
<pre>
$ clang-trunk -v
clang version 13.0.0 (https://github.com/llvm/llvm-project.git 2e9c75daffddd65e37c3236708b5b133e6f5f2f5)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/cnsun/usr/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ cat mutant.c
asm(" .align 3\n");
$ clang-trunk mutant.c
<inline asm>:1:9: error: alignment must be a power of 2
.align 3
^
clang-13: /tmp/tmp.xjN6dMkdrg-clang-builder/llvm-project/llvm/include/llvm/Support/Alignment.h:78: llvm::Align::Align(uint64_t): Assertion `llvm::isPowerOf2_64(Value) && "Alignment is not a power of 2"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /scratch/software/clang-trunk/bin/clang-13 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -main-file-name mutant.c -mrelocation-model static -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/scratch/cnsun/workspace/perses-fuzzer/default_c_finding_folder/crash_20210626_060606_04f5/delta/perses_result -resource-dir /scratch/software/clang-trunk/lib/clang/13.0.0 -c-isystem . -c-isystem /usr/local/include/cmsith -internal-isystem /scratch/software/clang-trunk/lib/clang/13.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/scratch/cnsun/workspace/perses-fuzzer/default_c_finding_folder/crash_20210626_060606_04f5/delta/perses_result -ferror-limit 19 -fgnuc-version=4.2.1 -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/mutant-ceb252.o -x c mutant.c
1. <eof> parser at end of file
2. Code generation
#​0 0x0000563a3c11b184 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
#​1 0x0000563a3c11893e SignalHandler(int) Signals.cpp:0:0
#​2 0x00007f41f18323c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
#​3 0x00007f41f12d118b raise /build/glibc-ZN95T4/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#​4 0x00007f41f12b0859 abort /build/glibc-ZN95T4/glibc-2.31/stdlib/abort.c:81:7
#​5 0x00007f41f12b0729 get_sysdep_segment_value /build/glibc-ZN95T4/glibc-2.31/intl/loadmsgcat.c:509:8
#​6 0x00007f41f12b0729 _nl_load_domain /build/glibc-ZN95T4/glibc-2.31/intl/loadmsgcat.c:970:34
#​7 0x00007f41f12c1f36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36)
#​8 0x0000563a3bc57507 llvm::MCAssembler::computeFragmentSize(llvm::MCAsmLayout const&, llvm::MCFragment const&) const (/scratch/software/clang-trunk/bin/clang-13+0x3497507)
#​9 0x0000563a3bc59095 llvm::MCAssembler::finishLayout(llvm::MCAsmLayout&) (/scratch/software/clang-trunk/bin/clang-13+0x3499095)
#​10 0x0000563a3bc5bc27 llvm::MCAssembler::layout(llvm::MCAsmLayout&) (/scratch/software/clang-trunk/bin/clang-13+0x349bc27)
#​11 0x0000563a3bc5c0dd llvm::MCAssembler::Finish() (/scratch/software/clang-trunk/bin/clang-13+0x349c0dd)
#​12 0x0000563a3bcaa6e5 llvm::MCStreamer::Finish(llvm::SMLoc) (/scratch/software/clang-trunk/bin/clang-13+0x34ea6e5)
#​13 0x0000563a3ce6989a llvm::AsmPrinter::doFinalization(llvm::Module&) (/scratch/software/clang-trunk/bin/clang-13+0x46a989a)
#​14 0x0000563a3b805f75 llvm::FPPassManager::doFinalization(llvm::Module&) (/scratch/software/clang-trunk/bin/clang-13+0x3045f75)
#​15 0x0000563a3b813176 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/scratch/software/clang-trunk/bin/clang-13+0x3053176)
#​16 0x0000563a3c44de72 (anonymous namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) BackendUtil.cpp:0:0
#​17 0x0000563a3c44f92d clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/scratch/software/clang-trunk/bin/clang-13+0x3c8f92d)
#​18 0x0000563a3d278e1f clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/scratch/software/clang-trunk/bin/clang-13+0x4ab8e1f)
#​19 0x0000563a3e3304d9 clang::ParseAST(clang::Sema&, bool, bool) (/scratch/software/clang-trunk/bin/clang-13+0x5b704d9)
#​20 0x0000563a3d277968 clang::CodeGenAction::ExecuteAction() (/scratch/software/clang-trunk/bin/clang-13+0x4ab7968)
#​21 0x0000563a3cb27599 clang::FrontendAction::Execute() (/scratch/software/clang-trunk/bin/clang-13+0x4367599)
#​22 0x0000563a3caba7e6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/scratch/software/clang-trunk/bin/clang-13+0x42fa7e6)
#​23 0x0000563a3cc05480 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/scratch/software/clang-trunk/bin/clang-13+0x4445480)
#​24 0x0000563a39a25696 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/scratch/software/clang-trunk/bin/clang-13+0x1265696)
#​25 0x0000563a39a219d8 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#​26 0x0000563a3994f0e6 main (/scratch/software/clang-trunk/bin/clang-13+0x118f0e6)
#​27 0x00007f41f12b20b3 __libc_start_main /build/glibc-ZN95T4/glibc-2.31/csu/../csu/libc-start.c:342:3
#​28 0x0000563a39a2154e _start (/scratch/software/clang-trunk/bin/clang-13+0x126154e)
clang-13: error: unable to execute command: Aborted (core dumped)
clang-13: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 13.0.0 (https://github.com/llvm/llvm-project.git 2e9c75daffddd65e37c3236708b5b133e6f5f2f5)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/cnsun/usr/bin
clang-13: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-13: note: diagnostic msg: /tmp/mutant-94a020.c
clang-13: note: diagnostic msg: /tmp/mutant-94a020.sh
clang-13: note: diagnostic msg:
********************
_Originally posted by @chengniansun in https://github.com/llvm/llvm-project/issues/50171#issuecomment-981043647_
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzlWVlz2zgS_jXyC4oqErwf_CDLVpIqJ3ZFzkzVvrBAEJQ44aEFQR_59dsNUBIpS06y8k5N1fqQSBzdXzf6ApA22cvlhHqEl6xeWUp29XdiPU7s64k9023kUci2aGriuFN7apMJjdZKbdqJO5vQBfytCrXu0ilvKngpy8ftl7WRzV-CqykMIFTE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