<html>
<head>
<base href="https://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 --- - undefined behaviour of nested anonymous unions with bitfields doesn't work as intended"
href="https://llvm.org/bugs/show_bug.cgi?id=24608">24608</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>undefined behaviour of nested anonymous unions with bitfields doesn't work as intended
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.6
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Sun
</td>
</tr>
<tr>
<th>OS</th>
<td>Solaris
</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>stefan.teleman@oracle.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>This is a placeholder bug for a patch I will be submitting very shortly.
in ${top_srcdir}/tools/clang/include/clang/lib/AST/TemplateBase.h:
class TemplateArgument makes uses of an anonymous union of several structs.
One of these structs, namely struct I, contains an union of bitfields. Also,
class TemplateArgument does not explicitly define a copy constructor and an
assignment operator, it relies on the compiler-generated defaults.
C++ bitfields inside an union are undefined behaviour according to the
Standard. Relying on compiler default-generated copy-constructor and
assignment operator for copying unions with bitfields of different type,
or size, is undefined behaviour as well.
This happens to work correctly on Intel (i386/x86_64) but does not work at
all on SPARC.
I have a patch for this defect, which corrects it. I will submit this patch
very shortly.
We have a number of clang and llvm patches for Solaris, and we have every
intention of contributing them to the project. This is just one of several
bugs with follow-up patches that I will be filing.</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>