[llvm-bugs] [Bug 27007] New: clang crashes on valid code at -O1 and above on x86_64-linux-gnu in LICM: Assertion `!Load->isVolatile() && "AST broken"' failed

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Mar 20 18:12:42 PDT 2016


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

            Bug ID: 27007
           Summary: clang crashes on valid code at -O1 and above on
                    x86_64-linux-gnu in LICM: Assertion
                    `!Load->isVolatile() && "AST broken"' failed
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The current clang trunk crashes when compiling the following test case on
x86_64-linux-gnu at -O1 and above in both 32-bit and 64-bit modes. 

This is a regression from 3.7.x.  


$ clang-trunk -v
clang version 3.9.0 (trunk 263888)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clang-trunk -O0 -c small.c
$ clang-3.7 -O1 -c small.c
$
$ clang-trunk -O1 -c small.c
clang-3.9:
/tmp/llvm-builder/llvm-source-trunk/lib/Transforms/Scalar/LICM.cpp:948: bool
llvm::promoteLoopAccessesToScalars(llvm::AliasSet&,
llvm::SmallVectorImpl<llvm::BasicBlock*>&,
llvm::SmallVectorImpl<llvm::Instruction*>&, llvm::PredIteratorCache&,
llvm::LoopInfo*, llvm::DominatorTree*, const llvm::TargetLibraryInfo*,
llvm::Loop*, llvm::AliasSetTracker*, llvm::LICMSafetyInfo*): Assertion
`!Load->isVolatile() && "AST broken"' failed.
#0 0x0000000001c7fdc5 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1c7fdc5)
#1 0x0000000001c7dd56 llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-3.9+0x1c7dd56)
#2 0x0000000001c7df74 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-3.9+0x1c7df74)
#3 0x00007fd49ea84340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007fd49dca6cc9 gsignal
/build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007fd49dcaa0d8 abort
/build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007fd49dc9fb86 __assert_fail_base
/build/eglibc-3GlaMS/eglibc-2.19/assert/assert.c:92:0
#7 0x00007fd49dc9fc32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x0000000001b42fd6 llvm::promoteLoopAccessesToScalars(llvm::AliasSet&,
llvm::SmallVectorImpl<llvm::BasicBlock*>&,
llvm::SmallVectorImpl<llvm::Instruction*>&, llvm::PredIteratorCache&,
llvm::LoopInfo*, llvm::DominatorTree*, llvm::TargetLibraryInfo const*,
llvm::Loop*, llvm::AliasSetTracker*, llvm::LICMSafetyInfo*)
(/usr/local/clang-trunk/bin/clang-3.9+0x1b42fd6)
#9 0x0000000001b47913 (anonymous namespace)::LICM::runOnLoop(llvm::Loop*,
llvm::LPPassManager&) (/usr/local/clang-trunk/bin/clang-3.9+0x1b47913)
#10 0x00000000024a922b llvm::LPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-3.9+0x24a922b)
#11 0x000000000190aca3 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-3.9+0x190aca3)
#12 0x00000000024882e7 (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-3.9+0x24882e7)
#13 0x000000000190b3e8 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-3.9+0x190b3e8)
#14 0x0000000001dc3239 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*) (/usr/local/clang-trunk/bin/clang-3.9+0x1dc3239)
#15 0x000000000237ec9a
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-3.9+0x237ec9a)
#16 0x00000000026b444d clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x26b444d)
#17 0x000000000237edfe clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-3.9+0x237edfe)
#18 0x00000000020bdf16 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-3.9+0x20bdf16)
#19 0x00000000020965f6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-3.9+0x20965f6)
#20 0x0000000002148822
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2148822)
#21 0x0000000000abe670 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-3.9+0xabe670)
#22 0x0000000000a7b09d main (/usr/local/clang-trunk/bin/clang-3.9+0xa7b09d)
#23 0x00007fd49dc91ec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#24 0x0000000000aba6f4 _start (/usr/local/clang-trunk/bin/clang-3.9+0xaba6f4)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang-3.9 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name small.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 -debugger-tuning=gdb
-coverage-file
/home/su/specres/good/20160319-clang-trunk-m64-O3-g-build-121330/small.c
-resource-dir /usr/local/clang-trunk/bin/../lib/clang/3.9.0 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.9.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -O1 -fdebug-compilation-dir
/home/su/specres/good/20160319-clang-trunk-m64-O3-g-build-121330 -ferror-limit
19 -fmessage-length 134 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -o small.o -x c small.c
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'CallGraph Pass Manager' on module 'small.c'.
4.      Running pass 'Loop Pass Manager' on function '@fn1'
5.      Running pass 'Loop Invariant Code Motion' on basic block '%for.body'
clang-3.9: error: unable to execute command: Aborted (core dumped)
clang-3.9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.0 (trunk 263888)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-3.9: 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-3.9: note: diagnostic msg:
********************

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

********************
$


--------------------------------------


int a, d, e;
static volatile int *b = &a;
char *c;

void
fn1 ()
{ 
  int *f = &e;
  for (; a;)
    { 
      int **g = &f;
      b = 0;
      d = 0;
      for (; d < 1; )
        { 
          *b;
          *g = 0;
        }
      *f = *c;
    }
}

-- 
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/20160321/890d3c8d/attachment-0001.html>


More information about the llvm-bugs mailing list