[LLVMbugs] [Bug 12073] New: Crash in union
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Feb 23 23:49:32 PST 2012
http://llvm.org/bugs/show_bug.cgi?id=12073
Bug #: 12073
Summary: Crash in union
Product: clang
Version: unspecified
Platform: PC
OS/Version: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: theone at ngs.ru
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
I tried to compile in XCode 4.2 with this code :
class cVector3du
{
public:
typedef cVector3d & cVector3dRef;
union
{
struct
{
float x;
float y;
float z;
};
float v[3];
};
};
class cMatrix4x4
{
public:
union
{
struct
{
sAxes axes;
cVector3du m_origin;
float m_w4;
};
struct
{
float _11, _12, _13, _14;
float _21, _22, _23, _24;
float _31, _32, _33, _34;
float _41, _42, _43, _44;
};
float m[4][4];
float f[16];
};
static const cMatrix4x4 Identity;
cMatrix4x4(){};
cMatrix4x4(float m11, float m12, float m13, float m14, float m21, float
m22, float m23, float m24,
float m31, float m32, float m33, float m34, float m41, float
m42, float m43, float m44):
_11(m11), _12(m12), _13( m13), _14(m14), _21(m21), _22(m22),
_23( m23 ), _24( m24),
_31(m31), _32(m32), _33( m33), _34(m34), _41(m41), _42(m42),
_43( m43 ), _44( m44){}
cMatrix4x4( const cVector3d & origin );
cMatrix4x4( const cVector3d & origin, const cVector3d & scale );
};
Compiler crashed with this stack
0 clang 0x0000000100de1252 PrintStackTrace(void*) + 34
1 clang 0x0000000100de1729 SignalHandler(int) + 633
2 libSystem.B.dylib 0x00007fff82d9c1ba _sigtramp + 26
3 libSystem.B.dylib 0x0000003f000692e0 _sigtramp + 2100089152
4 clang 0x00000001002b2d5a
llvm::GetElementPtrInst::GetElementPtrInst<llvm::Value**>(llvm::Value*,
llvm::Value**, llvm::Value**, unsigned int, llvm::Twine const&,
llvm::Instruction*) + 202
5 clang 0x0000000100692d09 llvm::IRBuilder<false,
llvm::ConstantFolder, llvm::IRBuilderDefaultInserter<false>
>::CreateConstInBoundsGEP2_32(llvm::Value*, unsigned int, unsigned int,
llvm::Twine const&) + 185
6 clang 0x00000001002b29bc
clang::CodeGen::CodeGenFunction::EmitLValueForField(llvm::Value*,
clang::FieldDecl const*, unsigned int) + 492
7 clang 0x0000000100508245
clang::CodeGen::CodeGenFunction::EmitLValueForFieldInitialization(llvm::Value*,
clang::FieldDecl const*, unsigned int) + 85
8 clang 0x00000001005037fa
clang::CodeGen::CodeGenFunction::EmitCtorPrologue(clang::CXXConstructorDecl
const*, clang::CXXCtorType, clang::CodeGen::FunctionArgList&) + 1322
9 clang 0x0000000100502f14
clang::CodeGen::CodeGenFunction::EmitConstructorBody(clang::CodeGen::FunctionArgList&)
+ 340
10 clang 0x00000001006850b3
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 675
11 clang 0x0000000100502d83
clang::CodeGen::CodeGenModule::EmitCXXConstructor(clang::CXXConstructorDecl
const*, clang::CXXCtorType) + 243
12 clang 0x0000000100686b1d
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl) + 285
13 clang 0x000000010011a64d
clang::CodeGen::CodeGenModule::EmitDeferred() + 189
14 clang 0x000000010011a494
clang::CodeGen::CodeGenModule::Release() + 20
15 clang 0x000000010011a35d
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 93
16 clang 0x0000000100042276 clang::ParseAST(clang::Sema&, bool) +
422
17 clang 0x0000000100040caf clang::CodeGenAction::ExecuteAction() +
671
18 clang 0x000000010002ca9b
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 875
19 clang 0x000000010002ab18
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2696
20 clang 0x000000010001f315 cc1_main(char const**, char const**,
char const*, void*) + 5333
21 clang 0x000000010000247b main + 667
22 clang 0x00000001000021d4 start + 52
I was able to solve problem:
struct matrix4x4
{
union
{
struct
{
sAxes axes;
cVector3du m_origin;
float m_w4;
};
struct
{
float _11, _12, _13, _14;
float _21, _22, _23, _24;
float _31, _32, _33, _34;
float _41, _42, _43, _44;
};
float m[4][4];
float f[16];
};
};
class cMatrix4x4 : public matrix4x4
{
public:
static const cMatrix4x4 Identity;
cMatrix4x4(){};
cMatrix4x4(float m11, float m12, float m13, float m14, float m21, float
m22, float m23, float m24,
float m31, float m32, float m33, float m34, float m41, float
m42, float m43, float m44):
_11(m11), _12(m12), _13( m13), _14(m14), _21(m21), _22(m22),
_23( m23 ), _24( m24),
_31(m31), _32(m32), _33( m33), _34(m34), _41(m41), _42(m42),
_43( m43 ), _44( m44){}
cMatrix4x4( const cVector3d & origin );
cMatrix4x4( const cVector3d & origin, const cVector3d & scale );
};
But this is not what i like to put in my project.
Thanks in advance.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list