Skip to content

Windows aarch64 (w/ inline asm .align): Failed to evaluate function length in SEH unwind info #122707

Closed as duplicate of#47432
@hmartinez82

Description

@hmartinez82

When adding an .align pseudo op to inline assembly (built with clang -c -v):

int f(int i) {
    int result;
    __asm__ (
        ".align 5 \n"
        "add %w0, %w1, #41"
        : "=r" (result)
        : "r" (i)
        :
    );
    return result;
}

Clang crashes with:

clang version 19.1.6
Target: aarch64-w64-windows-gnu
Thread model: posix
InstalledDir: C:/msys64/clangarm64/bin
 (in-process)
 "C:/msys64/clangarm64/bin/clang.exe" -cc1 -triple aarch64-w64-windows-gnu -emit-obj -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name align.c -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -mms-bitfields -funwind-tables=2 -fno-sized-deallocation -fno-use-init-array -target-cpu generic -target-feature +v8a -target-feature +fp-armv8 -target-feature +neon -target-abi aapcs -debugger-tuning=gdb -fdebug-compilation-dir=C:/Temp -v -fcoverage-compilation-dir=C:/Temp -resource-dir C:/msys64/clangarm64/lib/clang/19 -internal-isystem C:/msys64/clangarm64/lib/clang/19/include -internal-isystem C:/msys64/clangarm64/aarch64-w64-mingw32/include -internal-isystem C:/msys64/clangarm64/aarch64-w64-mingw32/usr/include -internal-isystem C:/msys64/clangarm64/include -ferror-limit 19 -fmessage-length=128 -fno-use-cxa-atexit -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -exception-model=seh -fcolor-diagnostics -faddrsig -o align.o -x c align.c
clang -cc1 version 19.1.6 based upon LLVM 19.1.6 default target aarch64-w64-windows-gnu
ignoring nonexistent directory "C:/msys64/clangarm64/aarch64-w64-mingw32/include"
ignoring nonexistent directory "C:/msys64/clangarm64/aarch64-w64-mingw32/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 C:/msys64/clangarm64/lib/clang/19/include
 C:/msys64/clangarm64/include
End of search list.
fatal error: error in backend: Failed to evaluate function length in SEH unwind info
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: C:\\msys64\\clangarm64\\bin\\clang.exe -c -v align.c
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'align.c'.
4.      Running pass 'AArch64 Assembly Printer' on function '@f'
Exception Code: 0xE0000046
#0 0x00007ff94adb6248 (C:\Windows\System32\KERNELBASE.dll+0xb6248)
#1 0x8364fff8508ed7d8
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 19.1.6
Target: aarch64-w64-windows-gnu
Thread model: posix
InstalledDir: C:/msys64/clangarm64/bin
clang: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: C:/msys64/tmp/align-fd02f8.c
clang: note: diagnostic msg: C:/msys64/tmp/align-fd02f8.sh
clang: note: diagnostic msg:

********************

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions