[llvm-bugs] [Bug 51680] 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.

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 30 12:22:05 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=51680

            Bug ID: 51680
           Summary: [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.
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: dimitry at andric.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

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 at 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);

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210830/3e4a9232/attachment.html>


More information about the llvm-bugs mailing list