clangupc / clang-upc

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

ppc64 LE - bug3198 gets assertion error in Struct-Debug branch #98

Open nenadv opened 7 years ago

nenadv commented 7 years ago

This test (and some other, all GWU NPB) fails to compile with internal assertion error. This is:

Optimized version does not fail, I guess no checking. But still it should exhibit some other issue if this is a serious problem. It also happens and dozen tests only.

http://upc-bugs.lbl.gov//upc_tests/index.php?date=2017-04-21&opt_dbg=both&branch=CUPC

Stack trace of the failure:

/home/phargrov/upcnightly/llvm-upc/bin/clang-upc -fupc-pts=struct -Wno-duplicate-decl-specifier -Werror=pointer-arith -g   -fupc-threads-1 -o bug3198_st01 bug3198.upc
clang-3.9: /home/phargrov/upcnightly/llvm-upc/src/lib/Support/APInt.cpp:1003: llvm::APInt llvm::APInt::zext(unsigned int) const: Assertion `width > BitWidth && "Invalid APInt ZeroExtend request"' failed.
0  clang-3.9 0x0000000012386624 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 88
1  clang-3.9 0x0000000012386a70
2  clang-3.9 0x0000000012384538 llvm::sys::RunSignalHandlers() + 180
3  clang-3.9 0x0000000012385ba4
4            0x00003fff82a30478 __kernel_sigtramp_rt64 + 0
5  libc.so.6 0x00003fff824a0d70 abort + 640
6  libc.so.6 0x00003fff824948a4
7  libc.so.6 0x00003fff82494994 __assert_fail + 100
8  clang-3.9 0x00000000122bea10 llvm::APInt::zext(unsigned int) const + 104
9  clang-3.9 0x00000000131b8038
10 clang-3.9 0x00000000131ba154
11 clang-3.9 0x00000000131bdcfc
12 clang-3.9 0x000000001316e730
13 clang-3.9 0x000000001316e90c
14 clang-3.9 0x000000001316d8e4
15 clang-3.9 0x00000000131d0a38 llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::AAResults&, llvm::CodeGenOpt::Level) + 108
16 clang-3.9 0x0000000013310dd4 llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 1104
17 clang-3.9 0x0000000013310578 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::Instruction const>, llvm::ilist_iterator<llvm::Instruction const>, bool&) + 300
18 clang-3.9 0x0000000013314eb0 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 3584
19 clang-3.9 0x000000001330f3bc llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 1664
20 clang-3.9 0x00000000110b07e4
21 clang-3.9 0x000000001169b7b0 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 548
22 clang-3.9 0x0000000011c2d5b0 llvm::FPPassManager::runOnFunction(llvm::Function&) + 368
23 clang-3.9 0x0000000011c2d814 llvm::FPPassManager::runOnModule(llvm::Module&) + 116
24 clang-3.9 0x0000000011c2dda0
25 clang-3.9 0x0000000011c2e70c llvm::legacy::PassManagerImpl::run(llvm::Module&) + 356
26 clang-3.9 0x0000000011c2eae8 llvm::legacy::PassManager::run(llvm::Module&) + 56
27 clang-3.9 0x0000000012711228
28 clang-3.9 0x00000000127113bc clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) + 164
29 clang-3.9 0x00000000134179f8
30 clang-3.9 0x00000000137b592c clang::ParseAST(clang::Sema&, bool, bool) + 956
31 clang-3.9 0x0000000012e527fc clang::ASTFrontendAction::ExecuteAction() + 468
32 clang-3.9 0x000000001341603c clang::CodeGenAction::ExecuteAction() + 1996
33 clang-3.9 0x0000000012e520c8 clang::FrontendAction::Execute() + 188
34 clang-3.9 0x0000000012ddeda0 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1352
35 clang-3.9 0x0000000012fff034 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1536
36 clang-3.9 0x0000000011001244 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 1156
37 clang-3.9 0x0000000010ff0a70
38 clang-3.9 0x0000000010ff1540 main + 2152
39 libc.so.6 0x00003fff82484700
40 libc.so.6 0x00003fff824848f4 __libc_start_main + 196
nenadv commented 7 years ago

I looked at bug3198.upc and was able to create a smaller test:

#include <upc.h>

shared int a[THREADS][10];

int main() {
    int i, j;
    for (i = 0; i < THREADS; ++i)
      for (j = 0; j < 10; ++j)
        a[i][j] = (10*i) + j;
}

Compile with the following two options:

-fupc-pts=struct -fupc-threads-1

It happens only with struct and fixed number of threads.