[LLVMbugs] [Bug 22960] New: Assertion during Loop Strength Reduction `!(*I)->isZero() && "Zero allocated in a base register!"' failed.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 19 17:39:22 PDT 2015


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

            Bug ID: 22960
           Summary: Assertion during Loop Strength Reduction
                    `!(*I)->isZero() && "Zero allocated in a base
                    register!"' failed.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: rtrieu at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

$ cat loopsr.c
typedef struct {
  void *ptr;
  int num;
} Struct1;

typedef struct {
  unsigned short size;
} Struct2;

typedef struct {
    Struct2 Array[256];
} Struct3;

typedef struct Struct4 {
  void (*Function)(Struct1 *);
} Struct4;

static void Bar(Struct1 *s) {
  Struct3 *s3 = s->ptr;
  int value = s->num > 2;
  int count = 0;

  for (int i = 0; i < 5; i++) {
    if (value && i == 0) continue;
    count++;
  }

  for (int i = count; i < 5; i++) {
    s3->Array[i].size = i - count;
  }
}

static void Foo(Struct1 *s){
  Bar(s);
}

struct Struct4 s = { Foo };

$ clang -O1 loopsr.c
clang-3.5: ../lib/Transforms/Scalar/LoopStrengthReduce.cpp:1307: bool
(anonymous namespace)::LSRUse::InsertFormula(const (anonymous
namespace)::Formula &): Assertion `!(*I)->isZero() && "Zero allocated in a base
register!"' failed.
#0 0x14c895a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/bin/clang-3.5+0x14c895a)
#1 0x14c9ddb SignalHandler(int) (/usr/local/bin/clang-3.5+0x14c9ddb)
#2 0x7fd487a04340 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#3 0x7fd486f30cc9 gsignal
/build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#4 0x7fd486f340d8 abort /build/buildd/eglibc-2.19/stdlib/abort.c:91:0
#5 0x7fd486f29b86 __assert_fail_base
/build/buildd/eglibc-2.19/assert/assert.c:92:0
#6 0x7fd486f29c32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#7 0x13df1b4 (anonymous namespace)::LSRInstance::InsertFormula((anonymous
namespace)::LSRUse&, unsigned int, (anonymous namespace)::Formula const&)
(/usr/local/bin/clang-3.5+0x13df1b4)
#8 0x13d6d82 (anonymous namespace)::LSRInstance::GenerateAllReuseFormulae()
(/usr/local/bin/clang-3.5+0x13d6d82)
#9 0x13ce9ed (anonymous namespace)::LSRInstance::LSRInstance(llvm::Loop*,
llvm::Pass*) (/usr/local/bin/clang-3.5+0x13ce9ed)
#10 0x13c903a (anonymous namespace)::LoopStrengthReduce::runOnLoop(llvm::Loop*,
llvm::LPPassManager&) (/usr/local/bin/clang-3.5+0x13c903a)
#11 0x1bd3d7e llvm::LPPassManager::runOnFunction(llvm::Function&)
(/usr/local/bin/clang-3.5+0x1bd3d7e)
#12 0x11b5565 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/bin/clang-3.5+0x11b5565)
#13 0x11b579b llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/local/bin/clang-3.5+0x11b579b)
#14 0x11b5c85 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/bin/clang-3.5+0x11b5c85)
#15 0x18e3e8d clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::StringRef, llvm::Module*, clang::BackendAction,
llvm::raw_ostream*) (/usr/local/bin/clang-3.5+0x18e3e8d)
#16 0x18d6425 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/bin/clang-3.5+0x18d6425)
#17 0x1e3b643 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/bin/clang-3.5+0x1e3b643)
#18 0x16596ae clang::FrontendAction::Execute()
(/usr/local/bin/clang-3.5+0x16596ae)
#19 0x162aa3c clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/bin/clang-3.5+0x162aa3c)
#20 0x16d4ec4 clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/bin/clang-3.5+0x16d4ec4)
#21 0x6ddac2 cc1_main(llvm::ArrayRef<char const*>, char const*, void*)
(/usr/local/bin/clang-3.5+0x6ddac2)
#22 0x6dca3f main (/usr/local/bin/clang-3.5+0x6dca3f)
#23 0x7fd486f1bec5 __libc_start_main
/build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#24 0x6d9aac _start (/usr/local/bin/clang-3.5+0x6d9aac)
Stack dump:
0.    Program arguments: /usr/local/bin/clang-3.5 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name loopsr.c
-mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-momit-leaf-frame-pointer -dwarf-column-info -resource-dir
/usr/local/bin/../lib/clang/3.7.0 -internal-isystem /usr/local/include
-internal-isystem /usr/local/bin/../lib/clang/3.7.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O1
-fdebug-compilation-dir /usr/local/home/rtrieu/test -ferror-limit 19
-fmessage-length 80 -mstackrealign -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/loopsr-47dd57.o -x c loopsr.c 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module 'loopsr.c'.
4.    Running pass 'Loop Pass Manager' on function '@Bar'
5.    Running pass 'Loop Strength Reduction' on basic block '%for.body10'
clang-3.5: error: unable to execute command: Aborted (core dumped)
clang-3.5: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.7.0 (trunk 232787)
Target: x86_64-unknown-linux-gnu
Thread model: posix

-- 
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/20150320/06ae772e/attachment.html>


More information about the llvm-bugs mailing list