clangupc / clang-upc

Clang UPC Front-End
https://clangupc.github.io/
Other
16 stars 5 forks source link

ICE on PPC32 #79

Closed PHHargrove closed 8 years ago

PHHargrove commented 9 years ago

The following input crashes "clang -m32" built from the Intrepid clang-upc source. However, it also crashes an unmodified clang-3.5 (/opt/clang-latest/ on gcc110 in the GCC CFarm).

Meanwhile, Hal Finkel's current clang-3.7 builds accept this source. So, this is an upstream bug that was fixed eventually and this issue is just for my reference in a KnownFailure entry for the BUPC test harness.

The code which passes a 64-bit struct (by value) via var args:

#include <stdarg.h>

struct xyz {
  int a;
  int b;
};

double foo(va_list ap) {
  int x = va_arg(ap, int);
  double y = *va_arg(ap, double *);
  struct xyz q = va_arg(ap, struct xyz);
  return x + y + q.b;
}

The ICE:

0  libLLVM-3.5.so 0x00003fffb49d2f3c llvm::sys::PrintStackTrace(_IO_FILE*) + 4284457060
1  libLLVM-3.5.so 0x00003fffb49d319c
2  libLLVM-3.5.so 0x00003fffb49d2850
3                 0x00003fffb5450448 __kernel_sigtramp_rt64 + 0
4                 0x00003ffff01e2240 __kernel_sigtramp_rt64 + 987307512
5  libLLVM-3.5.so 0x00003fffb3c70900 llvm::EVT::getEVT(llvm::Type*, bool) + 4270710064
6  libLLVM-3.5.so 0x00003fffb47b3d94 llvm::SelectionDAGBuilder::visitVAArg(llvm::VAArgInst const&) + 4282282500
7  libLLVM-3.5.so 0x00003fffb47a9558 llvm::SelectionDAGBuilder::visit(unsigned int, llvm::User const&) + 4282239688
8  libLLVM-3.5.so 0x00003fffb47c9984 llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) + 4282370596
9  libLLVM-3.5.so 0x00003fffb47d6118 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::Instruction const>, llvm::ilist_iterator<llvm::Instruction const>, bool&) + 4282420296
10 libLLVM-3.5.so 0x00003fffb47daa40 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 4282438928
11 libLLVM-3.5.so 0x00003fffb47dc734 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 4282446324
12 libLLVM-3.5.so 0x00003fffb4840634
13 libLLVM-3.5.so 0x00003fffb430e4e4 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 4277508996
14 libLLVM-3.5.so 0x00003fffb3c46a48 llvm::FPPassManager::runOnFunction(llvm::Function&) + 4270545144
15 libLLVM-3.5.so 0x00003fffb3c46aac llvm::FPPassManager::runOnModule(llvm::Module&) + 4270545228
16 libLLVM-3.5.so 0x00003fffb3c46538 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 4270543880
17 libLLVM-3.5.so 0x00003fffb3c46734 llvm::legacy::PassManager::run(llvm::Module&) + 4270544372
18 clang          0x0000000010397ac4 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) + 4277873292
19 clang          0x0000000010391818
20 clang          0x0000000010583e60 clang::ParseAST(clang::Sema&, bool, bool) + 4279836168
21 clang          0x00000000101bdaac clang::ASTFrontendAction::ExecuteAction() + 4275989780
22 clang          0x00000000103929fc clang::CodeGenAction::ExecuteAction() + 4277853492
23 clang          0x00000000101be6f0 clang::FrontendAction::Execute() + 4275992600
24 clang          0x00000000101979b8 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 4275837904
25 clang          0x000000001017a62c clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 4275724900
26 clang          0x00000000101750b8 cc1_main(char const**, char const**, char const*, void*) + 4275703472
27 clang          0x0000000010173338 main + 4275695504
28 libc.so.6      0x0000008074e9fb94
29 libc.so.6      0x0000008074e9fd90 __libc_start_main + 4293388240
Stack dump:
0.      Program arguments: /home/mik/misc/clang-3.5/bin/clang -cc1 -triple powerpc-unknown-linux-gnu -S -disable-free -disable-llvm-verifier -main-file-name bug137c.c -mrelocation-model static -mdisable-fp-elim -fmath-errno -no-integrated-as -mconstructor-aliases -fuse-init-array -target-cpu ppc -target-linker-version 2.23.51.0.1 -dwarf-column-info -coverage-file /tmp/bug137c-be42ba.s -resource-dir /home/mik/misc/clang-3.5/bin/../lib/clang/3.5.0 -internal-isystem /usr/local/include -internal-isystem /home/mik/misc/clang-3.5/bin/../lib/clang/3.5.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fno-dwarf-directory-asm -fdebug-compilation-dir /home/phargrov -ferror-limit 19 -fmessage-length 0 -mstackrealign -fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option -o /tmp/bug137c-be42ba.s -x c bug137c.c 
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'bug137c.c'.
4.      Running pass 'PowerPC DAG->DAG Pattern Instruction Selection' on function '@foo'
clang: error: unable to execute command: Illegal instruction
clang: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 3.5.0 (tags/RELEASE_350/final)
Target: powerpc-unknown-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/bug137c-52d465.c
clang: note: diagnostic msg: /tmp/bug137c-52d465.sh
clang: note: diagnostic msg: 

********************
nenadv commented 8 years ago

Seems to be fixed with 3.8 upgrade.