[LLVMbugs] [Bug 21383] New: Assertion `Numerator->isAffine() && "Numerator should be affine"' failed

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Oct 25 09:09:58 PDT 2014


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

            Bug ID: 21383
           Summary: Assertion `Numerator->isAffine() && "Numerator should
                    be affine"' failed
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hamish.ivey.law at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13250
  --> http://llvm.org/bugs/attachment.cgi?id=13250&action=edit
source and run script produced by clang

The assertion

  Assertion `Numerator->isAffine() && "Numerator should be affine"' failed

is triggered when compiling the following double loop with optimisation -O2 or
-O3:

--- num_is_aff.c ---
#define gel(m,x) (((long**)(m))[x])

long func1(long *phi, long L)
{
  long res[123];
  long i, j, c = 1;
  for (i = 1; i <= L + 1; ++i)
    for (j = 1; j <= i; ++j, ++c)
      res[j] = *gel(phi, c);
  return res[0];
}
---END---

The same error occurs with both the Release+Asserts and the Debug+Asserts
builds.  Here is the full stack trace (system info follows):

$ clang -c -O2 num_is_aff.c
clang: /home/hlaw/src/llvm/lib/Analysis/ScalarEvolution.cpp:814: void
{anonymous}::SCEVDivision::visitAddRecExpr(const llvm::SCEVAddRecExpr*):
Assertion `Numerator->isAffine() && "Numerator should be affine"' failed.
#0 0x29244b2 llvm::sys::PrintStackTrace(_IO_FILE*)
(/home/hlaw/local/bin/clang+0x29244b2)
#1 0x2922fd3 (/home/hlaw/local/bin/clang+0x2922fd3)
#2 0x7f8eb73d8030 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0xf030)
#3 0x7f8eb629c1a5 gsignal
/tmp/buildd/eglibc-2.13/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:64:0
#4 0x7f8eb629f420 abort /tmp/buildd/eglibc-2.13/stdlib/abort.c:94:0
#5 0x7f8eb6295351 __assert_fail /tmp/buildd/eglibc-2.13/assert/assert.c:81:0
#6 0x2685522 (/home/hlaw/local/bin/clang+0x2685522)
#7 0x2685266 (/home/hlaw/local/bin/clang+0x2685266)
#8 0x268568a (/home/hlaw/local/bin/clang+0x268568a)
#9 0x2685da3 llvm::ScalarEvolution::HowFarToZero(llvm::SCEV const*, llvm::Loop
const*, bool) (/home/hlaw/local/bin/clang+0x2685da3)
#10 0x2672ec7 llvm::ScalarEvolution::ComputeExitLimitFromICmp(llvm::Loop
const*, llvm::ICmpInst*, llvm::BasicBlock*, llvm::BasicBlock*, bool)
(/home/hlaw/local/bin/clang+0x2672ec7)
#11 0x2673042 llvm::ScalarEvolution::ComputeExitLimitFromCond(llvm::Loop
const*, llvm::Value*, llvm::BasicBlock*, llvm::BasicBlock*, bool)
(/home/hlaw/local/bin/clang+0x2673042)
#12 0x2673722 llvm::ScalarEvolution::ComputeExitLimit(llvm::Loop const*,
llvm::BasicBlock*) (/home/hlaw/local/bin/clang+0x2673722)
#13 0x2673935 llvm::ScalarEvolution::ComputeBackedgeTakenCount(llvm::Loop
const*) (/home/hlaw/local/bin/clang+0x2673935)
#14 0x2673c55 llvm::ScalarEvolution::getBackedgeTakenInfo(llvm::Loop const*)
(/home/hlaw/local/bin/clang+0x2673c55)
#15 0x2673f89 llvm::ScalarEvolution::getMaxBackedgeTakenCount(llvm::Loop
const*) (/home/hlaw/local/bin/clang+0x2673f89)
#16 0x26769ae llvm::ScalarEvolution::getSignedRange(llvm::SCEV const*)
(/home/hlaw/local/bin/clang+0x26769ae)
#17 0x2676eb5 llvm::ScalarEvolution::isKnownNonNegative(llvm::SCEV const*)
(/home/hlaw/local/bin/clang+0x2676eb5)
#18 0x267cb98
llvm::ScalarEvolution::getMulExpr(llvm::SmallVectorImpl<llvm::SCEV const*>&,
llvm::SCEV::NoWrapFlags) (/home/hlaw/local/bin/clang+0x267cb98)  
#19 0x23bd4c7 (/home/hlaw/local/bin/clang+0x23bd4c7)
#20 0x268438e llvm::ScalarEvolution::createNodeForGEP(llvm::GEPOperator*)
(/home/hlaw/local/bin/clang+0x268438e)
#21 0x2682d68 llvm::ScalarEvolution::createSCEV(llvm::Value*)
(/home/hlaw/local/bin/clang+0x2682d68)
#22 0x2683709 llvm::ScalarEvolution::getSCEV(llvm::Value*)
(/home/hlaw/local/bin/clang+0x2683709)
#23 0x256f2cc llvm::simplifyUsersOfIV(llvm::PHINode*, llvm::ScalarEvolution*,
llvm::LPPassManager*, llvm::SmallVectorImpl<llvm::WeakVH>&, llvm::IVVisitor*)
(/home/hlaw/local/bin/clang+0x256f2cc)
#24 0x25703c4 llvm::simplifyLoopIVs(llvm::Loop*, llvm::ScalarEvolution*,
llvm::LPPassManager*, llvm::SmallVectorImpl<llvm::WeakVH>&)
(/home/hlaw/local/bin/clang+0x25703c4)
#25 0x2538ed8 llvm::UnrollLoop(llvm::Loop*, unsigned int, unsigned int, bool,
unsigned int, llvm::LoopInfo*, llvm::Pass*, llvm::LPPassManager*,
llvm::AssumptionTracker*) (/home/hlaw/local/bin/clang+0x2538ed8)
#26 0x2409e00 (/home/hlaw/local/bin/clang+0x2409e00)
#27 0x2630d07 llvm::LPPassManager::runOnFunction(llvm::Function&)
(/home/hlaw/local/bin/clang+0x2630d07)
#28 0x28ae96f llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/hlaw/local/bin/clang+0x28ae96f)
#29 0x28ae9bb llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/hlaw/local/bin/clang+0x28ae9bb)
#30 0x28ae51f llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/hlaw/local/bin/clang+0x28ae51f)
#31 0x9860d8 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::StringRef, llvm::Module*, clang::BackendAction,
llvm::raw_ostream*) (/home/hlaw/local/bin/clang+0x9860d8)
#32 0x976ccf (/home/hlaw/local/bin/clang+0x976ccf)
#33 0xb59aba clang::ParseAST(clang::Sema&, bool, bool)
(/home/hlaw/local/bin/clang+0xb59aba)
#34 0x978bfe clang::CodeGenAction::ExecuteAction()
(/home/hlaw/local/bin/clang+0x978bfe)
#35 0x79da66 clang::FrontendAction::Execute()
(/home/hlaw/local/bin/clang+0x79da66)
#36 0x77824e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/hlaw/local/bin/clang+0x77824e)
#37 0x75e20c clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/hlaw/local/bin/clang+0x75e20c)
#38 0x756968 cc1_main(llvm::ArrayRef<char const*>, char const*, void*)
(/home/hlaw/local/bin/clang+0x756968)
#39 0x7418ca main (/home/hlaw/local/bin/clang+0x7418ca)
#40 0x7f8eb6288eed __libc_start_main
/tmp/buildd/eglibc-2.13/csu/libc-start.c:276:0
#41 0x75561d _start (/home/hlaw/local/bin/clang+0x75561d)
Stack dump:
0.      Program arguments: /home/hlaw/local/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name num_is_aff.c
-mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-target-linker-version 2.22 -momit-leaf-frame-pointer -dwarf-column-info
-coverage-file /home/hlaw/src/misc/clang-bug/num_is_aff.c -resource-dir
/home/hlaw/local/bin/../lib/clang/3.6.0 -c-isystem /home/hlaw/local/include
-c-isystem /home/hlaw/local/include -cxx-isystem /home/hlaw/local/include
-cxx-isystem /home/hlaw/local/include -cxx-isystem /home/hlaw/local/include
-internal-isystem /usr/local/include -internal-isystem
/home/hlaw/local/bin/../lib/clang/3.6.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -O2 -fdebug-compilation-dir
/home/hlaw/src/misc/clang-bug -ferror-limit 19 -fmessage-length 151
-mstackrealign -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics
-vectorize-loops -vectorize-slp -o num_is_aff.o -x c num_is_aff.c
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'Function Pass Manager' on module 'num_is_aff.c'.
4.      Running pass 'Loop Pass Manager' on function '@func1'
5.      Running pass 'Unroll loops' on basic block '%for.body3'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.6.0 (trunk 220613)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/num_is_aff-4c3f7a.c
clang: note: diagnostic msg: /tmp/num_is_aff-4c3f7a.sh
clang: note: diagnostic msg:

********************

$ clang --version
clang version 3.6.0 (trunk 220613)
Target: x86_64-unknown-linux-gnu
Thread model: posix

$ uname -a
Linux paridev 3.2.0-4-amd64 #1 SMP Debian 3.2.57-3+deb7u1 x86_64 GNU/Linux

-- 
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/20141025/01211b71/attachment.html>


More information about the llvm-bugs mailing list