[llvm-bugs] [Bug 24608] New: undefined behaviour of nested anonymous unions with bitfields doesn't work as intended
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Aug 27 19:24:23 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=24608
Bug ID: 24608
Summary: undefined behaviour of nested anonymous unions with
bitfields doesn't work as intended
Product: clang
Version: 3.6
Hardware: Sun
OS: Solaris
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: stefan.teleman at oracle.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150828/9a7a8370/attachment.html>
More information about the llvm-bugs
mailing list