<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - [powerpc64] After 14d8f1546a0, via SCEV, Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file llvm/include/llvm/Support/Casting.h, line 269."
   href="https://bugs.llvm.org/show_bug.cgi?id=51680">51680</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[powerpc64] After 14d8f1546a0, via SCEV, Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file llvm/include/llvm/Support/Casting.h, line 269.
          </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>All
          </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>dimitry@andric.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This assertion appeared when compiling the FreeBSD base system for PowerPC64
with clang 13:

Starting program: /home/dim/ins/llvmorg-13-init-14246-g14d8f1546a0/bin/clang
-cc1 -triple powerpc64-- -S -O1 opal_pci-min.c
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"),
function cast, file
/home/dim/src/llvm/llvm-project/llvm/include/llvm/Support/Casting.h, line 269.

Program received signal SIGABRT, Aborted.
thr_kill () at thr_kill.S:4
4       thr_kill.S: No such file or directory.
(gdb) bt
#0  thr_kill () at thr_kill.S:4
#1  0x0000000806199544 in __raise (s=s@entry=6) at
/usr/src/lib/libc/gen/raise.c:52
#2  0x000000080624e6a9 in abort () at /usr/src/lib/libc/stdlib/abort.c:67
#3  0x000000080617c461 in __assert (func=<optimized out>, file=<optimized out>,
line=<optimized out>, failedexpr=<optimized out>) at
/usr/src/lib/libc/gen/assert.c:51
#4  0x0000000001f16a7b in getNewAlignmentDiff(llvm::SCEV const*, llvm::SCEV
const*, llvm::ScalarEvolution*) ()
#5  0x0000000001f155f9 in getNewAlignment(llvm::SCEV const*, llvm::SCEV const*,
llvm::SCEV const*, llvm::Value*, llvm::ScalarEvolution*) ()
#6  0x0000000001f14bbf in
llvm::AlignmentFromAssumptionsPass::processAssumption(llvm::CallInst*, unsigned
int) ()
#7  0x0000000001f15d6f in
llvm::AlignmentFromAssumptionsPass::runImpl(llvm::Function&,
llvm::AssumptionCache&, llvm::ScalarEvolution*, llvm::DominatorTree*) ()
#8  0x0000000001f15f77 in
llvm::AlignmentFromAssumptionsPass::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&) ()
#9  0x000000000315ea12 in llvm::detail::PassModel<llvm::Function,
llvm::AlignmentFromAssumptionsPass, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&)
    ()
#10 0x0000000001b7e67c in llvm::PassManager<llvm::Function,
llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&) ()
#11 0x00000000024520d2 in llvm::detail::PassModel<llvm::Function,
llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>,
llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&) ()
#12 0x0000000001b83498 in llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&) ()
#13 0x0000000002454492 in llvm::detail::PassModel<llvm::Module,
llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&) ()
#14 0x0000000001b7d2ae in llvm::PassManager<llvm::Module,
llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&) ()
#15 0x00000000024496ac in (anonymous
namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction,
std::__1::unique_ptr<llvm::raw_pwrite_stream,
std::__1::default_delete<llvm::raw_pwrite_stream> >) ()
#16 0x00000000024446d5 in clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef,
llvm::Module*, clang::BackendAction,
std::__1::unique_ptr<llvm::raw_pwrite_stream,
std::__1::default_delete<llvm::raw_pwrite_stream> >) ()
#17 0x0000000003096612 in
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) ()
#18 0x0000000003402da3 in clang::ParseAST(clang::Sema&, bool, bool) ()
#19 0x0000000002a21a33 in clang::FrontendAction::Execute() ()
#20 0x00000000029a28e9 in
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) ()
#21 0x0000000002aca37c in
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) ()
#22 0x00000000008d4bc8 in cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) ()
#23 0x00000000008d2457 in ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
()
#24 0x00000000008d2209 in main ()

Minimized test case:

// clang -cc1 -triple powerpc64-- -S -O1 opal_pci-min.c
extern int a[];
long *b;
long c;
void *d(long, int *, int, long, long, long)
__attribute__((__alloc_align__(6)));
void e() {
  b = d(c, a, 0, 0, 5, c);
  b[0] = 0;
}

So the interesting part is where alloc_align(6) points at the sixth parameter
of 'd', which is the same as the first one. Originally, this function got
declared as:

void    *contigmalloc(unsigned long size, struct malloc_type *type, int flags,
            vm_paddr_t low, vm_paddr_t high, unsigned long alignment,
            vm_paddr_t boundary) __malloc_like __result_use_check
            __alloc_size(1) __alloc_align(6);</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>