<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - address_space casts causes assert"
href="http://llvm.org/bugs/show_bug.cgi?id=19887">19887</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>address_space casts causes assert
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jleidel@micron.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=12575" name="attach_12575" title="Sample source file">attachment 12575</a> <a href="attachment.cgi?id=12575&action=edit" title="Sample source file">[details]</a></span>
Sample source file
The crash occurs when using non-standard address_space definition and casting
the result of return values from functions. The assert occurs in a different
module than elicited in <a class="bz_bug_link
bz_status_NEW "
title="NEW --- - crash with address_space(256)"
href="show_bug.cgi?id=18549">bug 18549</a>. Verified to fail at all optimization levels
Compiled using LLVM/Clang 3.4.1 release:
clang version 3.4.1 (...)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang -O0 -S -emit-llvm
Abbreviated Trace:
/opt/micron/llvm/bin/clang -O0 -S -emit-llvm -o addrspace.ll addrspace.c
clang:
/pim_data/scratch/jleidel/pimcomp-3.4.1/llvm/lib/IR/Instructions.cpp:2352:
static llvm::CastInst* llvm::CastInst::Create(llvm::Instruction::CastOps,
llvm::Value*, llvm::Type*, const llvm::Twine&, llvm::Instruction*): Assertion
`castIsValid(op, S, Ty) && "Invalid cast!"' failed.
0 clang 0x0000000002320572 llvm::sys::PrintStackTrace(_IO_FILE*) +
34
1 clang 0x0000000002320189
2 libpthread.so.0 0x0000003a30c0f710
3 libc.so.6 0x0000003a30432925 gsignal + 53
4 libc.so.6 0x0000003a30434105 abort + 373
5 libc.so.6 0x0000003a3042ba4e
6 libc.so.6 0x0000003a3042bb10 __assert_perror_fail + 0
7 clang 0x000000000229e927
8 clang 0x00000000009d60f9
9 clang 0x000000000069d8df
10 clang 0x0000000000aab20c
11 clang 0x0000000000aabf55
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 85
The full trace is as follows:
/opt/micron/llvm/bin/clang -O0 -S -emit-llvm -o addrspace.ll addrspace.c
clang:
/pim_data/scratch/jleidel/pimcomp-3.4.1/llvm/lib/IR/Instructions.cpp:2352:
static llvm::CastInst* llvm::CastInst::Create(llvm::Instruction::CastOps,
llvm::Value*, llvm::Type*, const llvm::Twine&, llvm::Instruction*): Assertion
`castIsValid(op, S, Ty) && "Invalid cast!"' failed.
0 clang 0x0000000002320572 llvm::sys::PrintStackTrace(_IO_FILE*) +
34
1 clang 0x0000000002320189
2 libpthread.so.0 0x0000003a30c0f710
3 libc.so.6 0x0000003a30432925 gsignal + 53
4 libc.so.6 0x0000003a30434105 abort + 373
5 libc.so.6 0x0000003a3042ba4e
6 libc.so.6 0x0000003a3042bb10 __assert_perror_fail + 0
7 clang 0x000000000229e927
8 clang 0x00000000009d60f9
9 clang 0x000000000069d8df
10 clang 0x0000000000aab20c
11 clang 0x0000000000aabf55
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 85
12 clang 0x0000000000a6739f
clang::CodeGen::CodeGenFunction::EmitScalarInit(clang::Expr const*,
clang::ValueDecl const*, clan:CodeGen::LValue, bool) + 63
13 clang 0x0000000000a67fed
clang::CodeGen::CodeGenFunction::EmitExprAsInit(clang::Expr const*,
clang::ValueDecl const*, clan:CodeGen::LValue, bool) + 813
14 clang 0x0000000000a6a4f7
clang::CodeGen::CodeGenFunction::EmitAutoVarInit(clang::CodeGen::CodeGenFunction::AutoVarEmissiononst&)
+ 1335
15 clang 0x0000000000a6c742
clang::CodeGen::CodeGenFunction::EmitAutoVarDecl(clang::VarDecl const&) + 34
16 clang 0x00000000009cd38f
clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) + 63
17 clang 0x00000000009d4d32
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 370
18 clang 0x00000000009d1d78
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 24
19 clang 0x00000000009d238f
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, ng::CodeGen::AggValueSlot) + 79
20 clang 0x00000000009d2602
clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt const&,
bool, clang::CodeG:AggValueSlot) + 306
21 clang 0x00000000009d4c85
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 197
22 clang 0x00000000009d1d78
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 24
23 clang 0x00000000009d4c05
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 69
24 clang 0x00000000009d1d78
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 24
25 clang 0x00000000009d238f
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, ng::CodeGen::AggValueSlot) + 79
26 clang 0x00000000009de00d
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt st*) + 29
27 clang 0x00000000009e291e
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGenGFunctionInfo const&) + 1262
28 clang 0x00000000009f6e66
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl)
+ 678
29 clang 0x00000000009f7f8c
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl) + 524
30 clang 0x00000000009fad64
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 1492
31 clang 0x00000000009fb2d5
32 clang 0x000000000099bf93
33 clang 0x000000000099b5dc
34 clang 0x0000000000b15656 clang::ParseAST(clang::Sema&, bool, bool)
+ 310
35 clang 0x000000000099a25c clang::CodeGenAction::ExecuteAction() +
60
36 clang 0x00000000008242f9 clang::FrontendAction::Execute() + 249
37 clang 0x00000000008039d5
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 357
38 clang 0x00000000007ecd39
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1833
39 clang 0x00000000007e5158 cc1_main(char const**, char const**, char
const*, void*) + 1208
40 clang 0x00000000007e9f50 main + 688
41 libc.so.6 0x0000003a3041ed1d __libc_start_main + 253
42 clang 0x00000000007e3f51
Stack dump:
0. Program arguments: /pim_data/opt/micron/llvm-3.4.1/bin/clang -cc1
-triple x86_64-unknown-linux-gnu -emit-llvm -disable-free -m-file-name
addrspace.c -mrelocation-model static -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -tet-cpu x86-64
-target-linker-version 2.20.51.0.2 -coverage-file
/home/jleidel/dev/working/llvm_test/ir/addrspace.ll -resource-dir
/pimta/opt/micron/llvm-3.4.1/bin/../lib/clang/3.4.1 -internal-isystem
/usr/local/include -internal-isystem
/pim_data/opt/micron/llvm-3.4.1n/../lib/clang/3.4.1/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O0
-fdebug-compilation-dir /hojleidel/dev/working/llvm_test/ir -ferror-limit 19
-fmessage-length 137 -mstackrealign -fobjc-runtime=gcc
-fdiagnostics-show-option -verize-slp -o addrspace.ll -x c addrspace.c
1. <eof> parser at end of file
2. addrspace.c:10:5: LLVM IR generation of declaration 'main'
3. addrspace.c:10:5: Generating code for declaration 'main'
4. addrspace.c:13:2: LLVM IR generation of compound statement ('{}')
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.4.1
(<a href="http://svn/AMS/Compiler/pimcomp/trunk/llvm/3.4.1/cfe-3.4.1.src">http://svn/AMS/Compiler/pimcomp/trunk/llvm/3.4.1/cfe-3.4.1.src</a> 242)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source,d
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/addrspace-106d4a.c
clang: note: diagnostic msg: /tmp/addrspace-106d4a.sh
clang: note: diagnostic msg:
********************
make: *** [addrspace.ll] Error 254</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>