[LLVMbugs] [Bug 20822] New: clang crashes on valid code at -O1 and above on x86_64-linux-gnu
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sun Aug 31 14:45:49 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=20822
Bug ID: 20822
Summary: clang crashes on valid code at -O1 and above on
x86_64-linux-gnu
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: llvmbugs at cs.uiuc.edu
Classification: Unclassified
The current clang trunk crashes when compiling the following testcase at -O1
and above in both 32-bit and 64-bit modes on x86_64-linux-gnu.
This is a regression from clang 3.4.x.
$ clang-trunk -v
clang version 3.6.0 (trunk 216814)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8.1
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.6
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.1
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
$
$ clang-trunk -O0 small1.c; a.out
$ clang-3.4 -O1 small1.c; a.out
$
$ clang-trunk -O1 small1.c
clang: /tmp/llvm/include/llvm/Support/Casting.h:223: typename
std::enable_if<!is_simple_type<Y>::value, typename cast_retty<X, const
Y>::ret_type>::type llvm::cast(const Y &) [X = llvm::PHINode, Y =
llvm::ilist_iterator<llvm::Instruction>]: Assertion `isa<X>(Val) && "cast<Ty>()
argument of incompatible type!"' failed.
0 clang 0x00000000027e4e75 llvm::sys::PrintStackTrace(_IO_FILE*) +
37
1 clang 0x00000000027e56e3
2 libpthread.so.0 0x00007f2baa64fcb0
3 libc.so.6 0x00007f2ba946d425 gsignal + 53
4 libc.so.6 0x00007f2ba9470b8b abort + 379
5 libc.so.6 0x00007f2ba94660ee
6 libc.so.6 0x00007f2ba9466192
7 clang 0x00000000024084c6
8 clang 0x00000000023b1c6b
9 clang 0x00000000023b28d0
10 clang 0x000000000277499b
llvm::FPPassManager::runOnFunction(llvm::Function&) + 539
11 clang 0x000000000249a5c9
12 clang 0x0000000002775187
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 967
13 clang 0x00000000008d8af3
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) +
7187
14 clang 0x00000000008cea64
15 clang 0x0000000000ac52a3 clang::ParseAST(clang::Sema&, bool, bool)
+ 483
16 clang 0x00000000006effee clang::FrontendAction::Execute() + 62
17 clang 0x00000000006c3f9c
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 892
18 clang 0x00000000006a667a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3082
19 clang 0x000000000069cfdb cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 667
20 clang 0x00000000006a4c95 main + 11909
21 libc.so.6 0x00007f2ba945876d __libc_start_main + 237
22 clang 0x000000000069cc59
Stack dump:
0. Program arguments: /usr/local/clang-trunk/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name small1.c
-mrelocation-model static -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 -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/3.6.0 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/clang-trunk/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 -O1 -fdebug-compilation-dir
/data2/c-hunter-results/C/trans-bugs/REDUCED/20140830-clang-m32-m64-O1-O2-O3-Os-build-test914684
-ferror-limit 19 -fmessage-length 123 -mstackrealign -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/small1-74b34e.o -x c
small1.c
1. <eof> parser at end of file
2. Per-module optimization passes
3. Running pass 'CallGraph Pass Manager' on module 'small1.c'.
4. Running pass 'Combine redundant instructions' on function '@fn1'
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.6.0 (trunk 216814)
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/small1-d19af8.c
clang: note: diagnostic msg: /tmp/small1-d19af8.sh
clang: note: diagnostic msg:
********************
$
---------------------------
int a, c, d;
struct S
{
int f0;
} b;
void
fn1 ()
{
int e = 0;
struct S f = {0}, *g = &f;
if (d)
{
g = &f;
for (; e != 1; e = 1)
;
}
if (a)
{
struct S **h = &g;
*h = 0;
}
struct S **i = &g;
if (i != 0)
{
c = e;
*g = b;
}
}
int
main ()
{
fn1();
return 0;
}
--
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/20140831/6be4db5f/attachment.html>
More information about the llvm-bugs
mailing list