swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.69k stars 10.39k forks source link

[SR-4726] Clang abort in Function Pass Manager on aarch64 #47303

Open swift-ci opened 7 years ago

swift-ci commented 7 years ago
Previous ID SR-4726
Radar None
Original Reporter helge (JIRA User)
Type Bug

Attachment: Download

Environment uname -a Linux scw-66d779 4.9.23-std-1 \#1 SMP Mon Apr 24 13:18:14 UTC 2017 aarch64 aarch64 aarch64 GNU/Linux cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=16.04 DISTRIB_CODENAME=xenial DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS" cat /proc/cpuinfo processor : 0 BogoMIPS : 200.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics CPU implementer : 0x43 CPU architecture: 8 CPU variant : 0x1 CPU part : 0x0a1 CPU revision : 1 processor : 1 BogoMIPS : 200.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics CPU implementer : 0x43 CPU architecture: 8 CPU variant : 0x1 CPU part : 0x0a1 CPU revision : 1 processor : 2 BogoMIPS : 200.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics CPU implementer : 0x43 CPU architecture: 8 CPU variant : 0x1 CPU part : 0x0a1 CPU revision : 1 processor : 3 BogoMIPS : 200.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics CPU implementer : 0x43 CPU architecture: 8 CPU variant : 0x1 CPU part : 0x0a1 CPU revision : 1 processor : 4 BogoMIPS : 200.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics CPU implementer : 0x43 CPU architecture: 8 CPU variant : 0x1 CPU part : 0x0a1 CPU revision : 1 processor : 5 BogoMIPS : 200.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics CPU implementer : 0x43 CPU architecture: 8 CPU variant : 0x1 CPU part : 0x0a1 CPU revision : 1 processor : 6 BogoMIPS : 200.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics CPU implementer : 0x43 CPU architecture: 8 CPU variant : 0x1 CPU part : 0x0a1 CPU revision : 1 processor : 7 BogoMIPS : 200.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics CPU implementer : 0x43 CPU architecture: 8 CPU variant : 0x1 CPU part : 0x0a1 CPU revision : 1
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | Compiler | |Labels | Bug, arm, armv8 | |Assignee | None | |Priority | Medium | md5: 92b91016174ceafe6aa002189872d65f

Issue Description:

I'm trying to build Swift 3.1.1 on a Scaleway ARMv8 instance. This goes surprisingly far, but eventually clang fails on libdispatch/src/source.c.

clang-4.0: /swiftsrc/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:7065: void llvm::SelectionDAGBuilder::visitInlineAsm(llvm::ImmutableCallSite): Assertion `ConstraintID != InlineAsm::Constraint_Unknown && "Failed to convert memory constraint code to constraint id."' failed.
#​0 0x00000000014da90c llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/swiftsrc/build/buildbot_linux/llvm-linux-aarch64/bin/clang-4.0+0x14da90c)
Stack dump:
0.  Program arguments: /swiftsrc/build/buildbot_linux/llvm-linux-aarch64/bin/clang-4.0 -cc1 -triple aarch64-unknown-linux-gnu -emit-obj -disable-free -main-file-name source.c -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu generic -target-feature +neon -target-abi aapcs -momit-leaf-frame-pointer -dwarf-column-info -debugger-tuning=gdb -coverage-file /swiftsrc/build/buildbot_linux/libdispatch-linux-aarch64/src/.libs/source.o -resource-dir /swiftsrc/build/buildbot_linux/llvm-linux-aarch64/bin/../lib/clang/4.0.0 -isystem /usr/include/bsd -D HAVE_CONFIG_H -I . -I /swiftsrc/swift-corelibs-libdispatch/src -I ../config -I .. -I /swiftsrc/swift-corelibs-libdispatch -I /swiftsrc/swift-corelibs-libdispatch/private -I /swiftsrc/swift-corelibs-libdispatch/libpwq/include -D LIBBSD_OVERLAY -I /swiftsrc/swift-corelibs-libdispatch/src/BlocksRuntime -D PIC -internal-isystem /usr/local/include -internal-isystem /swiftsrc/build/buildbot_linux/llvm-linux-aarch64/bin/../lib/clang/4.0.0/include -internal-externc-isystem /usr/include/aarch64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wall -fdebug-compilation-dir /swiftsrc/build/buildbot_linux/libdispatch-linux-aarch64/src -ferror-limit 19 -fmessage-length 132 -fvisibility hidden -fallow-half-arguments-and-returns -fblocks -fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o .libs/source.o -x c /swiftsrc/swift-corelibs-libdispatch/src/source.c 
1.  <eof> parser at end of file
2.  Code generation
3.  Running pass 'Function Pass Manager' on module '/swiftsrc/swift-corelibs-libdispatch/src/source.c'.
4.  Running pass 'AArch64 Instruction Selection' on function '@_dispatch_mgr_invoke'
clang-4.0: error: unable to execute command: Aborted
clang-4.0: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 4.0.0 (https://github.com/apple/swift-clang.git f38438fc0161d13f2deb8b1cfb201af562692364) (https://github.com/apple/swift-llvm.git 9cb6a3ccee03e78b4258d2af093de0891b003d60)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /swiftsrc/build/buildbot_linux/llvm-linux-aarch64/bin
clang-4.0: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
belkadan commented 7 years ago

I suspect this is a bug in Clang, not Swift or libdispatch. Can you file a bug at https://bugs.llvm.org/ ?

swift-ci commented 7 years ago

Comment by Helge Heß (JIRA)

Bugs.llvm.org is closed for submission, I emailed them but didn't hear back.

Doesn't Swift use a patched clang as part of the build? That's the one which breaks which is why I filed it here.

belkadan commented 7 years ago

It's very unlikely that our changes have anything to do with this, though I suppose not impossible.

swift-ci commented 7 years ago

Comment by Adam Duracz (JIRA)

helge (JIRA User) I just got a reply to a registration request on the LLVM bug tracking site (sent to bugs-admin@lists.llvm.org) . Perhaps you'll have better luck if you try again now.

swift-ci commented 7 years ago

Comment by Helge Heß (JIRA)

Yes, I got an account a while ago. Need to file this issue there as well.

belkadan commented 7 years ago

We do use a downstream fork of Clang, yes, but we try to minimize the divergence. We'd prefer cherry-picks of fixes from upstream rather than fixing something in our fork first.