Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1227460

Summary: aarch64 clang segfaults on compiling hello world (or anything else)
Product: [Fedora] Fedora Reporter: Leif Lindholm <leif.lindholm>
Component: llvmAssignee: Adam Jackson <ajax>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: ajax, bos, dmalcolm, jv+fedora, mjuszkie, petersen, scottt.tw
Target Milestone: ---   
Target Release: ---   
Hardware: aarch64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-01-19 11:35:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 922257    
Attachments:
Description Flags
/tmp/hello-5c92b1.c
none
/tmp/hello-5c92b1.sh none

Description Leif Lindholm 2015-06-02 17:20:55 UTC
Description of problem:
Trying to compile
---
#include <stdio.h>

int main(void)
{
	printf("Hello, world!\n");
	return 0;
}
---
fails with a segfault (dumped onto console) and a return value at the prompt of 254.

Version-Release number of selected component (if applicable):
clang version 3.5.0 (tags/RELEASE_350/final)

How reproducible:
100%

Steps to Reproduce:
1. clang -c hello.c
2.
3.

Actual results:
Segfault.

Expected results:
Functional hello world program generated.

Additional info:
AMD Seattle Overdrive B0 platform (otherwise fully functional - gcc works fine and can rebuild the kernel among other things).

Comment 1 Marcin Juszkiewicz 2015-07-20 10:33:17 UTC
$ clang -v /tmp/hello.c ;echo $?                                                                                                                      
clang version 3.6.1 (tags/RELEASE_361/final)
Target: aarch64-redhat-linux-gnu
Thread model: posix
Found candidate GCC installation: /bin/../lib/gcc/aarch64-redhat-linux/5.1.1
Found candidate GCC installation: /usr/lib/gcc/aarch64-redhat-linux/5.1.1
Selected GCC installation: /bin/../lib/gcc/aarch64-redhat-linux/5.1.1
Candidate multilib: .;@m64
Selected multilib: .;@m64
 "/usr/bin/clang" -cc1 -triple aarch64-redhat-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name hello.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu generic -target-feature +neon -target-abi aapcs -target-linker-version 2.25 -v -dwarf-column-info -resource-dir /usr/bin/../lib/clang/3.6.1 -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/clang/3.6.1/include -internal-externc-isystem /usr/include -internal-externc-isystem /usr/lib/gcc/aarch64-redhat-linux/5.1.1/include -fdebug-compilation-dir /home/hrw/rpmbuild/fedora-packager/lv2-fabla -ferror-limit 19 -fmessage-length 187 -mstackrealign -fallow-half-arguments-and-returns -fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/hello-e9f3ec.o -x c /tmp/hello.c
clang -cc1 version 3.6.1 based upon LLVM 3.6.1 default target aarch64-redhat-linux-gnu
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/bin/../lib/clang/3.6.1/include
 /usr/include
 /usr/lib/gcc/aarch64-redhat-linux/5.1.1/include
End of search list.
#0 0x3ff986ec6c4 llvm::sys::PrintStackTrace(_IO_FILE*) (/usr/lib64/llvm/libLLVM-3.6.so+0x7ac6c4)
#1 0x3ff986eaeac (/usr/lib64/llvm/libLLVM-3.6.so+0x7aaeac)
#2 0x3ff99a50510 (linux-vdso.so.1+0x510)
#3 0x3ff98c5ef04 llvm::MachineInstr::addOperand(llvm::MachineFunction&, llvm::MachineOperand const&) (/usr/lib64/llvm/libLLVM-3.6.so+0xd1ef04)
#4 0x3ff98664b48 llvm::AArch64InstrInfo::storeRegToStackSlot(llvm::MachineBasicBlock&, llvm::MachineBasicBlock::bundle_iterator<llvm::MachineInstr, llvm::ilist_iterator<llvm::MachineInstr> >, unsigned int, bool, int, llvm::TargetRegisterClass const*, llvm::TargetRegisterInfo const*) const (/usr/lib64/llvm/libLLVM-3.6.so+0x724b48)
#5 0x3ff98cc2670 (/usr/lib64/llvm/libLLVM-3.6.so+0xd82670)
#6 0x3ff98cc32c8 (/usr/lib64/llvm/libLLVM-3.6.so+0xd832c8)
#7 0x3ff98cc61f8 (/usr/lib64/llvm/libLLVM-3.6.so+0xd861f8)
#8 0x3ff98cc6974 (/usr/lib64/llvm/libLLVM-3.6.so+0xd86974)
#9 0x3ff9890f54c llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/lib64/llvm/libLLVM-3.6.so+0x9cf54c)
#10 0x3ff9890f880 llvm::FPPassManager::runOnModule(llvm::Module&) (/usr/lib64/llvm/libLLVM-3.6.so+0x9cf880)
#11 0x3ff9890fb10 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/lib64/llvm/libLLVM-3.6.so+0x9cfb10)
#12 0x2aad1537114 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) (/usr/bin/clang+0x577114)
#13 0x2aad1527f40 (/usr/bin/clang+0x567f40)
#14 0x2aad16c35d8 clang::ParseAST(clang::Sema&, bool, bool) (/usr/bin/clang+0x7035d8)
#15 0x2aad152857c clang::CodeGenAction::ExecuteAction() (/usr/bin/clang+0x56857c)
#16 0x2aad13b7164 clang::FrontendAction::Execute() (/usr/bin/clang+0x3f7164)
#17 0x2aad1393490 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/bin/clang+0x3d3490)
#18 0x2aad137d66c clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/bin/clang+0x3bd66c)
#19 0x2aad1379020 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang+0x3b9020)
#20 0x2aad1377da8 main (/usr/bin/clang+0x3b7da8)
#21 0x3ff97a0fafc __libc_start_main (/lib64/libc.so.6+0x1fafc)
#22 0x2aad13785c4 _start (/usr/bin/clang+0x3b85c4)
Stack dump:
0.      Program arguments: /usr/bin/clang -cc1 -triple aarch64-redhat-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name hello.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu generic -target-feature +neon -target-abi aapcs -target-linker-version 2.25 -v -dwarf-column-info -resource-dir /usr/bin/../lib/clang/3.6.1 -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/clang/3.6.1/include -internal-externc-isystem /usr/include -internal-externc-isystem /usr/lib/gcc/aarch64-redhat-linux/5.1.1/include -fdebug-compilation-dir /home/hrw/rpmbuild/fedora-packager/lv2-fabla -ferror-limit 19 -fmessage-length 187 -mstackrealign -fallow-half-arguments-and-returns -fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/hello-e9f3ec.o -x c /tmp/hello.c 
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module '/tmp/hello.c'.
4.      Running pass 'Fast Register Allocator' on function '@main'
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 3.6.1 (tags/RELEASE_361/final)
Target: aarch64-redhat-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
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: /tmp/hello-5c92b1.c
clang: note: diagnostic msg: /tmp/hello-5c92b1.sh
clang: note: diagnostic msg: 

********************
254

Comment 2 Marcin Juszkiewicz 2015-07-20 10:34:21 UTC
Created attachment 1053820 [details]
/tmp/hello-5c92b1.c

Comment 3 Marcin Juszkiewicz 2015-07-20 10:34:48 UTC
Created attachment 1053821 [details]
/tmp/hello-5c92b1.sh

Comment 4 Marcin Juszkiewicz 2015-09-16 13:48:28 UTC
problem still present in rawhide

Comment 5 Marcin Juszkiewicz 2016-01-19 11:35:07 UTC
12:32 hrw@pinkiepie-rawhide:devel$ clang -v hello.c
clang version 3.7.0 (tags/RELEASE_370/final)
Target: aarch64-redhat-linux-gnu
Thread model: posix
Found candidate GCC installation: /bin/../lib/gcc/aarch64-redhat-linux/5.3.1
Found candidate GCC installation: /usr/lib/gcc/aarch64-redhat-linux/5.3.1
Selected GCC installation: /bin/../lib/gcc/aarch64-redhat-linux/5.3.1
Candidate multilib: .;@m64
Selected multilib: .;@m64
 "/usr/bin/clang" -cc1 -triple aarch64-redhat-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name hello.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu generic -target-feature +neon -target-abi aapcs -target-linker-version 2.25.1 -v -dwarf-column-info -resource-dir /usr/bin/../lib/clang/3.7.0 -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/clang/3.7.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /home/hrw/devel -ferror-limit 19 -fmessage-length 138 -mstackrealign -fallow-half-arguments-and-returns -fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/hello-4f4ec2.o -x c hello.c
clang -cc1 version 3.7.0 based upon LLVM 3.7.0 default target aarch64-redhat-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/bin/../lib/clang/3.7.0/include
 /usr/include
End of search list.
 "/bin/ld" --hash-style=gnu --no-add-needed --build-id --eh-frame-hdr -m aarch64linux -dynamic-linker /lib/ld-linux-aarch64.so.1 -o a.out /bin/../lib/gcc/aarch64-redhat-linux/5.3.1/../../../../lib64/crt1.o /bin/../lib/gcc/aarch64-redhat-linux/5.3.1/../../../../lib64/crti.o /bin/../lib/gcc/aarch64-redhat-linux/5.3.1/crtbegin.o -L/bin/../lib/gcc/aarch64-redhat-linux/5.3.1 -L/bin/../lib/gcc/aarch64-redhat-linux/5.3.1/../../../../lib64 -L/usr/bin/../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/bin/../lib/gcc/aarch64-redhat-linux/5.3.1/../../.. -L/usr/bin/../lib -L/lib -L/usr/lib /tmp/hello-4f4ec2.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /bin/../lib/gcc/aarch64-redhat-linux/5.3.1/crtend.o /bin/../lib/gcc/aarch64-redhat-linux/5.3.1/../../../../lib64/crtn.o
12:32 hrw@pinkiepie-rawhide:devel$ ./a.out 
hello world