clangupc / clang-upc

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

ICE: llvm/lib/VMCore/Constants.cpp Assertion `CastInst::castIsValid(opc, C, Ty) && "Invalid constante xpr cast!"' failed. #14

Closed gary-funck closed 11 years ago

gary-funck commented 11 years ago

The following test case failed with the following internal error.

clangupc -fupc-pts-packed -g  -I. -Wno-implicit-functi
on-declaration -Wno-deprecated -fno-caret-diagnostics -Wno-logical-op-parenthes
es -Wno-unused-comparison -Wno-unused-value -Wno-dangling-else -g   -DBUPC_TEST
_HARNESS -fupc-threads-4 -c issue64b.upc
clang-3.2: /eng/upc/dev/gary/clang/src/llvm/lib/VMCore/Constants.cpp:1393: stat
ic llvm::Constant* llvm::ConstantExpr::getCast(unsigned int, llvm::Constant*, l
lvm::Type*): Assertion `CastInst::castIsValid(opc, C, Ty) && "Invalid constante
xpr cast!"' failed.
0  clang-3.2       0x00000000016975a6
1  clang-3.2       0x000000000169727c
2  libpthread.so.0 0x0000003991a0f00
3  libc.so.6       0x0000003991635ba5 gsignal + 53
4  libc.so.6       0x0000003991637358 abort + 328
5  libc.so.6       0x000000399162e972
6  libc.so.6       0x000000399162ea22
7  clang-3.2       0x00000000014d9ba1 llvm::ConstantExpr::getCast(unsigned int,
 llvm::Constant*, llvm::Type*) + 177
8  clang-3.2       0x0000000000ca22f2
9  clang-3.2       0x0000000000ca4940
10 clang-3.2       0x000000000119a814
11 clang-3.2       0x00000000017eeb9b
12 clang-3.2       0x00000000017f9d93
13 clang-3.2       0x00000000017f90d1
14 clang-3.2       0x00000000017e8be5
15 clang-3.2       0x00000000017f7dc6 clang::CodeGen::CodeGenFunction::EmitScal
arExpr(clang::Expr const*, bool) + 156
[...]
gary-funck commented 11 years ago

Here is the test case.

// Tester for "issue 64" compliance: upc_barrier argument
// Copyright 2013, The Regents of the University of California,
// through Lawrence Berkeley National Laboratory (subject to
// receipt of any required approvals from U.S. Dept. of Energy)
// See the full license terms at
//       http://upc.lbl.gov/download/dist/LICENSE.TXT

#include <upc.h>

shared int x;

int main(void) {

  // This is an implicit pointer-to-shared -> integer conversion and should at least warn.
  upc_barrier &x;
  upc_notify &x;
  upc_wait &x;

  return 0;
}
swatanabe commented 11 years ago

This is effectively a duplicate of #16. CodeGen doesn't know what to do with these casts.