<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 --- - Pointer cast from standard address_space to non-standard one causes assert"
href="http://llvm.org/bugs/show_bug.cgi?id=20135">20135</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Pointer cast from standard address_space to non-standard one 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>Linux
</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>dmcdb@trialsoftware.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=12706" name="attach_12706" title="preprocessed source & associated run script">attachment 12706</a> <a href="attachment.cgi?id=12706&action=edit" title="preprocessed source & associated run script">[details]</a></span>
preprocessed source & associated run script
Clang crashes when a pointer value of the standard address space is casted into
non-standard address space and assigned to a pointer variable of a non-standard
address space.
This occurs only when the source file has .cpp extension. The same source file
with .c extension compiles ok.
Crash backtrace is as follows:
clang: /home/nhaketa/src/llvm-3.5.x/llvm/lib/IR/Instructions.cpp:1085: void
llvm::StoreInst::AssertOK(): Assertion `getOperand(0)->getType() ==
cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a
pointer to Val type!"' failed.
0 clang 0x000000000209afa2 llvm::sys::PrintStackTrace(_IO_FILE*) +
34
1 clang 0x000000000209a844
2 libpthread.so.0 0x0000003a18e0f710
3 libc.so.6 0x0000003a18a32925 gsignal + 53
4 libc.so.6 0x0000003a18a34105 abort + 373
5 libc.so.6 0x0000003a18a2ba4e
6 libc.so.6 0x0000003a18a2bb10 __assert_perror_fail + 0
7 clang 0x0000000002010ccc llvm::StoreInst::AssertOK() + 140
8 clang 0x000000000093613b
clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(llvm::Value*, llvm::Value*,
bool, unsigned int, clang::QualType, llvm::MDNode*, bool, clang::QualType,
unsigned long) + 219
9 clang 0x00000000009365a1
clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(llvm::Value*,
clang::CodeGen::LValue, bool) + 65
10 clang 0x0000000000939a9b
clang::CodeGen::CodeGenFunction::EmitStoreThroughLValue(clang::CodeGen::RValue,
clang::CodeGen::LValue, bool) + 1179
11 clang 0x00000000009435de
clang::CodeGen::CodeGenFunction::EmitBinaryOperatorLValue(clang::BinaryOperator
const*) + 734
12 clang 0x000000000093f4e5
clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr const*) + 1029
13 clang 0x000000000093fb18
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) + 24
14 clang 0x0000000000859bcf
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 255
15 clang 0x000000000085a1ff
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot) + 79
16 clang 0x000000000086af74
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*) + 276
17 clang 0x000000000086cb84
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 836
18 clang 0x000000000088d9e4
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) + 468
19 clang 0x000000000088edb7
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) + 503
20 clang 0x00000000008919cd
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 1677
21 clang 0x0000000000892320
22 clang 0x00000000008233b3
23 clang 0x000000000081f18c
24 clang 0x00000000009d5d0e clang::ParseAST(clang::Sema&, bool, bool)
+ 302
25 clang 0x000000000082075b clang::CodeGenAction::ExecuteAction() +
59
26 clang 0x0000000000683246 clang::FrontendAction::Execute() + 118
27 clang 0x000000000065ebd0
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 304
28 clang 0x0000000000646d33
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2115
29 clang 0x000000000063d858 cc1_main(char const**, char const**, char
const*, void*) + 968
30 clang 0x0000000000644192 main + 1362
31 libc.so.6 0x0000003a18a1ed1d __libc_start_main + 253
32 clang 0x000000000063cd65
Stack dump:
0. Program arguments: /usr/local/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-llvm -disable-free -main-file-name foo.cpp
-mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-target-linker-version 2.20.51.0.2 -coverage-file
/home/nhaketa/src/clang-test/foo.ll -resource-dir
/usr/local/bin/../lib/clang/3.5.0 -internal-isystem
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0
-internal-isystem
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/x86_64-unknown-linux-gnu
-internal-isystem
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/backward
-internal-isystem
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/x86_64-unknown-linux-gnu/c++/4.9.0
-internal-isystem /usr/local/include -internal-isystem
/usr/local/bin/../lib/clang/3.5.0/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -fdeprecated-macro
-fdebug-compilation-dir /home/nhaketa/src/clang-test -ferror-limit 19
-fmessage-length 209 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -o foo.ll -x c++ foo.cpp
1. <eof> parser at end of file
2. foo.cpp:4:6: LLVM IR generation of declaration 'func'
3. foo.cpp:4:6: Generating code for declaration 'func'
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.5.0 (trunk 211489)
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, 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/foo-2b54c7.ii
clang: note: diagnostic msg: /tmp/foo-2b54c7.sh
clang: note: diagnostic msg:
********************</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>