[LLVMbugs] [Bug 9429] New: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Mar 8 14:11:13 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=9429

           Summary: Assertion `isa<X>(Val) && "cast<Ty>() argument of
                    incompatible type!"' failed.
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: regehr at cs.utah.edu
                CC: llvmbugs at cs.uiuc.edu


[regehr at bethe tmp607]$ clang -v

clang version 3.0 (trunk 127271)
Target: x86_64-unknown-linux-gnu
Thread model: posix

[regehr at bethe tmp607]$ clang -O -c small.c

small.c:51:16: warning: implicit conversion from 'long' to 'uint8_t' (aka
'unsigned char')
      changes value from 57653 to 53 [-Wconstant-conversion]
    l_266[i] = 0xE135L;
             ~ ^~~~~~~
clang:
/uusoc/exports/scratch/regehr/z/compiler-build/llvm-r127271/include/llvm/Support/Casting.h:202:
typename llvm::cast_retty<To, From>::ret_type llvm::cast(const Y&) [with X =
llvm::BinaryOperator, Y = llvm::Value*]: Assertion `isa<X>(Val) && "cast<Ty>()
argument of incompatible type!"' failed.
0  clang           0x000000000184fccf
1  clang           0x0000000001851f42
2  libpthread.so.0 0x00007ffff7bd2190
3  libc.so.6       0x00007ffff6ed74b5 gsignal + 53
4  libc.so.6       0x00007ffff6edaf50 abort + 384
5  libc.so.6       0x00007ffff6ed0481 __assert_fail + 241
6  clang           0x0000000001536e8c llvm::cast_retty<llvm::BinaryOperator,
llvm::Value*>::ret_type llvm::cast<llvm::BinaryOperator,
llvm::Value*>(llvm::Value* const&) + 44
7  clang           0x00000000016d4d75 llvm::isPowerOfTwo(llvm::Value*,
llvm::TargetData const*, unsigned int) + 373
8  clang           0x00000000016db3ba llvm::isKnownNonZero(llvm::Value*,
llvm::TargetData const*, unsigned int) + 1498
9  clang           0x000000000166aac4
10 clang           0x00000000015d4267
11 clang           0x00000000015a7364
12 clang           0x00000000015a7bf7
13 clang           0x000000000179dbcd
llvm::FPPassManager::runOnFunction(llvm::Function&) + 557
14 clang           0x000000000164193b
15 clang           0x0000000001642095
16 clang           0x000000000179d764
llvm::MPPassManager::runOnModule(llvm::Module&) + 500
17 clang           0x000000000179d8d7 llvm::PassManagerImpl::run(llvm::Module&)
+ 167
18 clang           0x000000000080b4c9
clang::EmitBackendOutput(clang::Diagnostic&, clang::CodeGenOptions const&,
clang::TargetOptions const&, llvm::Module*, clang::BackendAction,
llvm::raw_ostream*) + 1625
19 clang           0x00000000008085bb
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 251
20 clang           0x0000000000929b03 clang::ParseAST(clang::Sema&, bool) + 275
21 clang           0x0000000000807d64 clang::CodeGenAction::ExecuteAction() +
68
22 clang           0x000000000070141b
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 347
23 clang           0x00000000006dab72
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1298
24 clang           0x00000000006d21f4 cc1_main(char const**, char const**, char
const*, void*) + 500
25 clang           0x00000000006d9c65 main + 4837
26 libc.so.6       0x00007ffff6ec2abd __libc_start_main + 253
27 clang           0x00000000006d0a09
Stack dump:
0.    Program arguments:
/uusoc/exports/scratch/regehr/z/compiler-install/llvm-gcc-r127271-install/bin/clang
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name
small.c -mrelocation-model static -mdisable-fp-elim -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.20 -momit-leaf-frame-pointer -resource-dir
/uusoc/exports/scratch/regehr/z/compiler-install/llvm-gcc-r127271-install/bin/../lib/clang/3.0
-O2 -ferror-limit 19 -fmessage-length 93 -fgnu-runtime
-fdiagnostics-show-option -fcolor-diagnostics -o small.o -x c small.c 
1.    <eof> parser at end of file
2.    Per-module optimization passes
3.    Running pass 'CallGraph Pass Manager' on module 'small.c'.
4.    Running pass 'Combine redundant instructions' on function '@func_62'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal 1 (use -v to see
invocation)

[regehr at bethe tmp607]$ cat small.c


typedef signed char int8_t;
typedef int int32_t;
typedef long int int64_t;
typedef unsigned char uint8_t;
typedef unsigned long int uint64_t;
static int64_t
safe_div_func_int64_t_s_s (int64_t si1, int8_t si2)
{
  return si2 == si1 && si2 == 0 ? : (si1 / si2);
}

static uint64_t
safe_add_func_uint64_t_u_u (uint64_t ui1, uint64_t ui2)
{
  return ui1 + ui2;
}

struct S0
{
  signed f2:55 > 1 * 8 ? (55 % sizeof (int) * 8) : 0;
};
struct S0 g_276[9][9] = {
};

struct S0 g_278 = {
  3L
};

int32_t func_85 (int64_t p_86);
uint8_t
func_62 (int32_t * p_63)
{
  struct S0 *l_275 = &g_276[0][3];
  uint8_t *l_272[6][4][1];
  const struct S0 *l_277 = &g_278;
  *p_63 ^= 1
    && safe_add_func_uint64_t_u_u (l_272[0][1][0] != 0,
                   safe_div_func_int64_t_s_s (!
                                  (l_275 !=
                                   l_277),
                                  func_85 (1)));
  return 0;
}

int32_t
func_85 (int64_t p_86)
{
  uint8_t l_266[5];
  int i;
  for (i = 0; i < 5; i++)
    l_266[i] = 0xE135L;
  return l_266[3];
}

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list