<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 --- - Path-aware TBAA produces the same mangled name for internal names"
href="http://llvm.org/bugs/show_bug.cgi?id=17997">17997</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Path-aware TBAA produces the same mangled name for internal names
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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>rnk@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dan433584@gmail.com, llvmbugs@cs.uiuc.edu, mren@apple.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>The non-path-aware TBAA code has this fragment of code:
if (const EnumType *ETy = dyn_cast<EnumType>(Ty)) {
// In C++ mode, types have linkage, so we can rely on the ODR and
// on their mangled names, if they're external.
// TODO: Is there a way to get a program-wide unique name for a
// decl with local linkage or no linkage?
if (!Features.CPlusPlus || !ETy->getDecl()->isExternallyVisible())
return MetadataCache[Ty] = getChar();
SmallString<256> OutName;
llvm::raw_svector_ostream Out(OutName);
MContext.mangleTypeName(QualType(ETy, 0), Out);
Out.flush();
return MetadataCache[Ty] = createTBAAScalarType(OutName, getChar());
}
Path-aware TBAA doesn't have any such condition. Is this a problem? Do the
names matter? I don't see any code that combines them in lib/Linker or
lib/LTO. You can see the issue for this program:
$ cat t.cpp
namespace {
struct Foo {
#ifdef CONFIG_1
int a;
#endif
int b;
};
}
int *store1();
#ifdef CONFIG_1
static Foo c;
int *store1() {
c.b = 42;
return &c.b;
}
#else
static Foo c;
int *store2() {
c.b = 43;
return &c.b;
}
int main() {
return *store1() + *store2();
}
#endif
$ clang++ -c t.cpp -O1 -emit-llvm -S -o - -DCONFIG_1 | grep ZTS && clang++
t.cpp -c -o t2.bc -O1 -emit-llvm -o - -S | grep _ZTS
!2 = metadata !{metadata !"_ZTSN12_GLOBAL__N_13FooE", metadata !3, i64 0,
metadata !3, i64 4}
!2 = metadata !{metadata !"_ZTSN12_GLOBAL__N_13FooE", metadata !3, i64 0}
They use the same name, "_ZTSN12_GLOBAL__N_13FooE".</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>