Search

XMMATRIX not properly aligned when using c++11 auto keyword. by MerickLDS

Closed

1
0
Sign in
to vote
Type: Bug
ID: 761026
Opened: 9/3/2012 6:42:29 PM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
When compiling C++ code which uses the DirectXMath library structures like XMMATRIX, if local variables are declared using the "auto" keyword from functions which return such structures, the resulting assembly does not ensure these stack variables are properly aligned to a 16 byte boundary.

Simply removing the "auto" keyword and replacing it with "XMMATRIX" results in correct assembly which runs without errors.
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling Version

Visual Studio 2012

Steps to reproduce

Create a new C++ console application, compile, and run the following code.

#include <DirectXMath.h>
using namespace DirectX;

int _tmain(int argc, _TCHAR* argv[])
{
auto m1 = XMMatrixIdentity();
auto m2 = XMMatrixIdentity();

auto t1 = XMMatrixTranspose( m1 );
auto t2 = XMMatrixTranspose( m2 );

return 0;
}

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

Running the code results in an "Access violation reading location 0xFFFFFFFF."

Expected results

Code should run without error.
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 11/15/2012 at 9:50 AM
Hi:
    Thanks for reporting the issue.
    A fix for this issue has been checked into the compiler sources. The fix should show up in the next release of Visual C++.

Xiang Fan
Visual C++ Team
Posted by Microsoft on 9/4/2012 at 2:21 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Microsoft Visual Studio Connect Support Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 9/3/2012 at 6:51 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)
Sign in to post a workaround.