[llvm-bugs] [Bug 34856] New: Assertion on vector code: "Invalid constantexpr cast!"

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 5 22:03:55 PDT 2017


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

            Bug ID: 34856
           Summary: Assertion on vector code: "Invalid constantexpr cast!"
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: babokin at gmail.com
                CC: llvm-bugs at lists.llvm.org

clang trunk rev314936, x86_64.

The diagnostic in this bug is the same as in a number of still opened issues,
but the test case is quite regular C++, though with vector extensions. Other
issues use __asm__() to trigger the problem. So this seems to be a different
problem with same diagnostic.

> cat f.cpp
typedef unsigned a __attribute__((ext_vector_type(8)));
a b, c, d, e;
void f() {
  a g(-(-~0 % (c * c | b)));
  d = -~0 % (c * c | b) + e % (g & 508903);
}

> clang++ -std=c++11 -c -O2 f.cpp
clang-6.0: /home/dybaboki/llvm/llvm-trunk-20171004/lib/IR/Constants.cpp:1440:
static llvm::Constant *llvm::ConstantExpr::getCast(unsigned int, llvm::Constant
*, llvm::Type *, bool): Assertion `CastInst::castIsValid(opc, C, Ty) &&
"Invalid constantexpr cast!"' failed.
#0 0x000000000135083f llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/dybaboki/llvm/bin-trunk-20171004/bin/clang-6.0+0x135083f)
#1 0x0000000001350b46 SignalHandler(int)
(/home/dybaboki/llvm/bin-trunk-20171004/bin/clang-6.0+0x1350b46)
#2 0x00007f59617f3370 __restore_rt (/lib64/libpthread.so.0+0xf370)
#3 0x00007f596036f1d7 __GI_raise (/lib64/libc.so.6+0x351d7)
#4 0x00007f59603708c8 __GI_abort (/lib64/libc.so.6+0x368c8)
#5 0x00007f5960368146 __assert_fail_base (/lib64/libc.so.6+0x2e146)
#6 0x00007f59603681f2 (/lib64/libc.so.6+0x2e1f2)
#7 0x0000000000e528bc llvm::ConstantExpr::getCast(unsigned int,
llvm::Constant*, llvm::Type*, bool)
(/home/dybaboki/llvm/bin-trunk-20171004/bin/clang-6.0+0xe528bc)
#8 0x00000000009f3ac0 llvm::ConstantFoldInstruction(llvm::Instruction*,
llvm::DataLayout const&, llvm::TargetLibraryInfo const*)
(/home/dybaboki/llvm/bin-trunk-20171004/bin/clang-6.0+0x9f3ac0)
#9 0x0000000000feccb2 llvm::InstCombiner::run()
(/home/dybaboki/llvm/bin-trunk-20171004/bin/clang-6.0+0xfeccb2)
#10 0x0000000000fef026 combineInstructionsOverFunction(llvm::Function&,
llvm::InstCombineWorklist&, llvm::AAResults*, llvm::AssumptionCache&,
llvm::TargetLibraryInfo&, llvm::DominatorTree&,
llvm::OptimizationRemarkEmitter&, bool, llvm::LoopInfo*)
(/home/dybaboki/llvm/bin-trunk-20171004/bin/clang-6.0+0xfef026)
#11 0x0000000000fef6ba
llvm::InstructionCombiningPass::runOnFunction(llvm::Function&)
(/home/dybaboki/llvm/bin-trunk-20171004/bin/clang-6.0+0xfef6ba)
<...>

-- 
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/20171006/ae52772d/attachment.html>


More information about the llvm-bugs mailing list