warning C4324 raised in error in 64-bit builds - by Mark Bicknell

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 604477 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 9/24/2010 4:25:36 AM
Access Restriction Public


I have been trying to chase down some compile warnings in my codebase when building for 64-bit.  My dev environment is Visual Studio 2010 in Windows 7.  I'm building the following code snippet for x64 (_WIN64)with warning level 4:

__declspec(align(16)) class MyVector
    float f[4];

class happyClass
  virtual void lol() = 0;
  virtual ~happyClass();
  float        f1;
  float        f2;

class unhappyClass
  virtual void lol() = 0;
  virtual ~unhappyClass();

  float        f1;
  float        f2;
  MyVector wat; //< C4324

C_ASSERT(offsetof(unhappyClass, f1)==sizeof(void*));
C_ASSERT(offsetof(unhappyClass, f2)==sizeof(void*)+sizeof(float));
C_ASSERT(offsetof(unhappyClass, wat)==16);

The C_ASSERTS are both passing, as expected, because the vtable pointer is 8 bytes.  At the line indicated, I'm getting the following warning emitted:

warning C4324: 'errorClass' : structure was padded due to __declspec(align())

It seems that the compiler is getting confused here.  This is a significant issue for us as a middleware developer as we need to run with warning level 4 and warnings as errors.
Sign in to post a comment.
Posted by Microsoft on 10/28/2010 at 2:49 PM
Hello Kodiak,

Thank you for providing this feedback. We have identified a bug in our compiler where the compiler believes that it has inserted an alignment member when it has not. Despite the warning, your structure is correctly aligned; the alignment member inserted by the compiler is zero bytes in size.

Since the compiler is still aligning your structure correctly and the warning itself is errorneous, the priority of this bug is too low for fixing in the next release. Please disable the warning as a workaround.

Mark Roberts
Visual C++ Compiler Team
Posted by Microsoft on 9/26/2010 at 7:50 PM
Thanks for your feedback. We are routing this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 9/24/2010 at 5:01 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)