<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - need to mangle string literal objects in inline variable initializers"
href="https://bugs.llvm.org/show_bug.cgi?id=41458">41458</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>need to mangle string literal objects in inline variable initializers
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++'17
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>richard-llvm@metafoo.co.uk
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Testcase:
inline const char *const str = "foo";
const char *p = str;
For this, Clang emits:
@.str = private unnamed_addr constant [4 x i8] c"foo\00", align 1
@p = dso_local global i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str,
i32 0, i32 0), align 8
... which is incorrect. 'str' is required to have a single value across
translation units, so the same string literal object must be used as its
initializer in all cases.
We need to give the string literal a mangling in this case. The Itanium ABI
doesn't specify a mangling for this case; I've filed
<a href="https://github.com/itanium-cxx-abi/cxx-abi/issues/78">https://github.com/itanium-cxx-abi/cxx-abi/issues/78</a> for that.</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>