<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed."
   href="https://llvm.org/bugs/show_bug.cgi?id=24955">24955</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>rich@pennware.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=14943" name="attach_14943" title="This file contains a shell script an the failing C code.">attachment 14943</a> <a href="attachment.cgi?id=14943&action=edit" title="This file contains a shell script an the failing C code.">[details]</a></span>
This file contains a shell script an the failing C code.

I get an error using a recent (r248677) TOT.
I was originally compiling the libedit library for several targets (ARM, Mips,
etc.) It seems to fail for all architectures. I have simplified the error
causing code using clang for x86_64 (test case attached).
Here is the error:

lang: /home/rich/llvm/include/llvm/Support/Casting.h:237: typename
llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::IntegerType; Y
= llvm::Type; typename llvm::cast_retty<X, Y*>::ret_type = llvm::IntegerType*]:
Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
0  clang           0x0000000002fe84f5
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  clang           0x0000000002fe75d6 llvm::sys::RunSignalHandlers() + 54
2  clang           0x0000000002fe77f4
3  libpthread.so.0 0x00000037bf6100d0
4  libc.so.6       0x00000037bea348d7 gsignal + 55
5  libc.so.6       0x00000037bea3653a abort + 362
6  libc.so.6       0x00000037bea2d47d
7  libc.so.6       0x00000037bea2d532
8  clang           0x0000000000e5dd35
9  clang           0x0000000002d08af2
llvm::ScalarEvolution::isImpliedCondOperandsViaNoOverflow(llvm::CmpInst::Predicate,
llvm::SCEV const*, llvm::SCEV const*, llvm::SCEV const*, llvm::SCEV const*) +
322
10 clang           0x0000000002d08c86
llvm::ScalarEvolution::isImpliedCondOperands(llvm::CmpInst::Predicate,
llvm::SCEV const*, llvm::SCEV const*, llvm::SCEV const*, llvm::SCEV const*) +
86
11 clang           0x0000000002d08fc0
llvm::ScalarEvolution::isImpliedCond(llvm::CmpInst::Predicate, llvm::SCEV
const*, llvm::SCEV const*, llvm::CmpInst::Predicate, llvm::SCEV const*,
llvm::SCEV const*) + 720
12 clang           0x0000000002d06382
llvm::ScalarEvolution::isImpliedCond(llvm::CmpInst::Predicate, llvm::SCEV
const*, llvm::SCEV const*, llvm::Value*, bool) + 450
13 clang           0x0000000002d06663
llvm::ScalarEvolution::isLoopEntryGuardedByCond(llvm::Loop const*,
llvm::CmpInst::Predicate, llvm::SCEV const*, llvm::SCEV const*) + 211
14 clang           0x0000000002d09772
15 clang           0x0000000002d09cb8
llvm::ScalarEvolution::HowManyLessThans(llvm::SCEV const*, llvm::SCEV const*,
llvm::Loop const*, bool, bool) + 72
16 clang           0x0000000002cf685e
llvm::ScalarEvolution::ComputeExitLimitFromICmp(llvm::Loop const*,
llvm::ICmpInst*, llvm::BasicBlock*, llvm::BasicBlock*, bool) + 862
17 clang           0x0000000002cf6aa9
llvm::ScalarEvolution::ComputeExitLimitFromCond(llvm::Loop const*,
llvm::Value*, llvm::BasicBlock*, llvm::BasicBlock*, bool) + 233
18 clang           0x0000000002cf726c
llvm::ScalarEvolution::ComputeExitLimit(llvm::Loop const*, llvm::BasicBlock*) +
636
19 clang           0x0000000002cf7472
llvm::ScalarEvolution::ComputeBackedgeTakenCount(llvm::Loop const*) + 402
20 clang           0x0000000002cf7868
llvm::ScalarEvolution::getBackedgeTakenInfo(llvm::Loop const*) + 616
21 clang           0x0000000002cf80a9
llvm::ScalarEvolution::getBackedgeTakenCount(llvm::Loop const*) + 9
22 clang           0x0000000002974e78
23 clang           0x0000000002cab24b
llvm::LPPassManager::runOnFunction(llvm::Function&) + 1899
24 clang           0x0000000002f5af23
llvm::FPPassManager::runOnFunction(llvm::Function&) + 643
25 clang           0x0000000002c1ae57
26 clang           0x0000000002f5b668
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 872
27 clang           0x0000000000c76441
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_pwrite_stream*)
+ 3345
28 clang           0x0000000000c55c7d
29 clang           0x0000000000e8318d clang::ParseAST(clang::Sema&, bool, bool)
+ 845
30 clang           0x0000000000c568eb clang::CodeGenAction::ExecuteAction() +
59
31 clang           0x0000000000a71906 clang::FrontendAction::Execute() + 294
32 clang           0x0000000000a4ab29
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 361
33 clang           0x0000000000a2ed03
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2131
34 clang           0x0000000000a26008 cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 3224
35 clang           0x00000000009e7098 main + 5896
36 libc.so.6       0x00000037bea1ffe0 __libc_start_main + 240
37 clang           0x0000000000a24aa7
Stack dump:
0.      Program arguments: /home/rich/llvm-dir/bin/clang -cc1 -emit-obj
-disable-free -main-file-name refresh.c -mrelocation-model static
-mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases
-target-cpu x86-64 -target-linker-version 2.24 -momit-leaf-frame-pointer -g
-dwarf-column-info -sys-header-deps -D HAVE_CONFIG_H -O2
-Wno-unneeded-internal-declaration -Wno-cast-align
-Wno-incompatible-pointer-types -Wno-string-plus-int -Wno-pointer-sign
-Wno-array-bounds -Wno-dangling-else -Wno-int-to-pointer-cast -ferror-limit 19
-fmessage-length 81 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -x c refresh-5c84f0.c 
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'CallGraph Pass Manager' on module 'refresh-5c84f0.c'.
4.      Running pass 'Loop Pass Manager' on function '@re_update_line'
5.      Running pass 'Induction Variable Simplification' on basic block
'%land.rhs.16'
refresh-5c84f0.sh: line 4: 29452 Aborted                 (core dumped)
"/home/rich/llvm-dir/bin/clang" "-cc1" "-emit-obj" "-disable-free"
"-main-file-name" "refresh.c" "-mrelocation-model" "static" "-mthread-model"
"posix" "-fmath-errno" "-masm-verbose" "-mconstructor-aliases" "-target-cpu"
"x86-64" "-target-linker-version" "2.24" "-momit-leaf-frame-pointer" "-g"
"-dwarf-column-info" "-sys-header-deps" "-D" "HAVE_CONFIG_H" "-O2"
"-Wno-unneeded-internal-declaration" "-Wno-cast-align"
"-Wno-incompatible-pointer-types" "-Wno-string-plus-int" "-Wno-pointer-sign"
"-Wno-array-bounds" "-Wno-dangling-else" "-Wno-int-to-pointer-cast"
"-ferror-limit" "19" "-fmessage-length" "81" "-fobjc-runtime=gcc"
"-fdiagnostics-show-option" "-fcolor-diagnostics" "-vectorize-loops"
"-vectorize-slp" "-x" "c" "refresh-5c84f0.c"
[~] dev%</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>