[llvm-bugs] [Bug 31262] New: crash on valid C code at -O1 and above in both 32-bit and 64-bit modes on x86_64-linux-gnu ()

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Dec 5 01:04:29 PST 2016


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

            Bug ID: 31262
           Summary: crash on valid C code at -O1 and above in both 32-bit
                    and 64-bit modes on x86_64-linux-gnu ()
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chengniansun at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

$ clang-trunk -v
clang version 4.0.0 (trunk 288620)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
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.5
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.2
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
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.8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ 
$ clang-trunk -O1 small.c
#0 0x0000000001d27065 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1d27065)
#1 0x0000000001d2503e llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-4.0+0x1d2503e)
#2 0x0000000001d251a2 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-4.0+0x1d251a2)
#3 0x00007feae0534330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x000000000190f40e llvm::ConstantExpr::isGEPWithNoNotionalOverIndexing()
const (/usr/local/clang-trunk/bin/clang-4.0+0x190f40e)
#5 0x000000000190196a evaluateICmpRelation(llvm::Constant*, llvm::Constant*,
bool) (/usr/local/clang-trunk/bin/clang-4.0+0x190196a)
#6 0x0000000001901d9b llvm::ConstantFoldCompareInstruction(unsigned short,
llvm::Constant*, llvm::Constant*)
(/usr/local/clang-trunk/bin/clang-4.0+0x1901d9b)
#7 0x0000000001921a19 llvm::ConstantExpr::getICmp(unsigned short,
llvm::Constant*, llvm::Constant*, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x1921a19)
#8 0x000000000154c299 SimplifyICmpInst(unsigned int, llvm::Value*,
llvm::Value*, (anonymous namespace)::Query const&, unsigned int)
(/usr/local/clang-trunk/bin/clang-4.0+0x154c299)
#9 0x000000000154e424 llvm::SimplifyICmpInst(unsigned int, llvm::Value*,
llvm::Value*, llvm::DataLayout const&, llvm::TargetLibraryInfo const*,
llvm::DominatorTree const*, llvm::AssumptionCache*, llvm::Instruction const*)
(/usr/local/clang-trunk/bin/clang-4.0+0x154e424)
#10 0x000000000154f2bd llvm::SimplifyInstruction(llvm::Instruction*,
llvm::DataLayout const&, llvm::TargetLibraryInfo const*, llvm::DominatorTree
const*, llvm::AssumptionCache*)
(/usr/local/clang-trunk/bin/clang-4.0+0x154f2bd)
#11 0x0000000001b9afd0 (anonymous namespace)::EarlyCSE::run()
(/usr/local/clang-trunk/bin/clang-4.0+0x1b9afd0)
#12 0x0000000001b9d56b (anonymous
namespace)::EarlyCSELegacyCommonPass<false>::runOnFunction(llvm::Function&)
[clone .part.383] (/usr/local/clang-trunk/bin/clang-4.0+0x1b9d56b)
#13 0x0000000001992e83 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1992e83)
#14 0x0000000001992ff7
llvm::legacy::FunctionPassManagerImpl::run(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1992ff7)
#15 0x000000000199346c llvm::legacy::FunctionPassManager::run(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-4.0+0x199346c)
#16 0x0000000001e967b6 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/usr/local/clang-trunk/bin/clang-4.0+0x1e967b6)
#17 0x0000000001e98645 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/usr/local/clang-trunk/bin/clang-4.0+0x1e98645)
#18 0x00000000024be1cb
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-4.0+0x24be1cb)
#19 0x00000000028b3212 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x28b3212)
#20 0x00000000024b94de clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-4.0+0x24b94de)
#21 0x00000000021c8cc6 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-4.0+0x21c8cc6)
#22 0x00000000021a2d66
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-4.0+0x21a2d66)
#23 0x0000000002251c7a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-4.0+0x2251c7a)
#24 0x0000000000ac28c8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-4.0+0xac28c8)
#25 0x0000000000a64881 main (/usr/local/clang-trunk/bin/clang-4.0+0xa64881)
#26 0x00007feadf310f45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#27 0x0000000000abe8ce _start (/usr/local/clang-trunk/bin/clang-4.0+0xabe8ce)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang-4.0 -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 -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/4.0.0 -c-isystem . -c-isystem
/usr/local/include/csmith-2.2.0/ -c-isystem /usr/local/include/csmith-2.2.0/
-internal-isystem /usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/4.0.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/cnsun/ramdisk/reduction/20161203-clang-trunk-m64-Weverything-g-O3-build-215525/delta
-ferror-limit 19 -fmessage-length 132 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/small-e34e02.o -x c
small.c 
1.      <eof> parser at end of file
2.      Per-function optimization
3.      Running pass 'Early CSE' on function '@main'
clang-4.0: error: unable to execute command: Segmentation fault (core dumped)
clang-4.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.0 (trunk 288620)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-4.0: 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-4.0: note: diagnostic msg: 
********************

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

********************
$ 
$ cat small.c
int a[1];
int main () {
  long b;
  return &a[b] >= a;
}
$

-- 
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/20161205/5a4a29eb/attachment.html>


More information about the llvm-bugs mailing list