<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 --- - Clang hit invalid cast assertion when calling a member function of an object not in the default address space"
href="http://llvm.org/bugs/show_bug.cgi?id=22831">22831</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang hit invalid cast assertion when calling a member function of an object not in the default address space
</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>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>interceptor2012@gmail.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=13999" name="attach_13999" title="Output from Clang, including the assertion hit and the stack trace.">attachment 13999</a> <a href="attachment.cgi?id=13999&action=edit" title="Output from Clang, including the assertion hit and the stack trace.">[details]</a></span>
Output from Clang, including the assertion hit and the stack trace.
Overview:
When compiling code that calls a member function of an object in a non-default
address space (e.g. address space 1), Clang hits an "invalid cast" assertion in
LLVM.
Steps to Reproduce:
See attached stack trace, preprocessed source, and run script. I also tested
this issue using optimization level 0 and using the spir-unknown-unknown
target; the error occurs with these options as well.
Actual Results:
Clang hits an LLVM assertion.
Expected Results:
At the very least, Clang should produce a diagnostic for this code if the
operation is invalid (rather than falling through to an LLVM assert). However,
I expect Clang should be able to generate valid code for this example. Since
this member function is not virtual, Clang should be able to resolve it at
compile time and simply pass a "this" pointer in the appropriate address space
to the function. This behavior may differ if virtual functions are considered.
Build Date & Platform:
Tested on 03/05/2015 using Ubuntu 12.04 and LLVM and Clang trunk.
Additional Builds and Platforms:
N/A
Additional Information:
My intent is to generate SPIR code from C++ code similar to this minimal
example. This code does not use virtual functions, so all function calls can
be resolved at compile time. I believe that the address space in which an
object exists should not influence the ability to call member functions of that
object. Thus, I should be able to have an object in the global address space
(address space 1 in SPIR) and still be able to call member functions, as long
as these functions can be resolved at compile time. I am not certain how
virtual functions would impact this process.</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>