Search

VS2010 x64 Compiler generates crash when passing aligned arguments. by MWassmer42

Active

4
0
Sign in
to vote
Type: Bug
ID: 775847
Opened: 1/4/2013 5:47:09 PM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
In some cases passing __declspec(aligned) arguments into a function will cause crashes at runtime when compiling in x64. Compiling in x86 actually throws a compiler error. Compiling in x64 should either throw the compiler error or (preferably) work. I"m attaching sample code that exhibits the problem under VS2010 SP1. Interestingly, this problem seems to already be fixed on VS2012 (couldn't repro on VS2012), but we really need it also fixed on 2010.

Details (expand)

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

Visual Studio 2012

Steps to reproduce

Compile this and run it in VS2010 SP1.

#include <xmmintrin.h>
#include <stdio.h>

enum EZero { kZero };

struct Vector
{
    Vector();
    Vector(EZero);
    explicit Vector(__m128 v);
    
    __m128 v;
};

__declspec(noinline) Vector::Vector() {}
__declspec(noinline) Vector::Vector(EZero) : v(_mm_setzero_ps()) {}
__declspec(noinline) Vector::Vector(__m128 v) : v(v) {}

Vector __declspec(noinline) add(Vector x, Vector y)
{
    return Vector(_mm_add_ps(x.v, y.v));
}

int main()
{
    Vector vBlah = add(kZero, kZero);
    printf("%f", _mm_cvtss_f32(vBlah.v));
    return 0;
}

Product Language

English

Operating System

Windows 7 SP1

Operating System Language

English

Actual results

Crash with no compiler errors / warnings.

Expected results

Code works or throws compiler error.
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 1/6/2013 at 6:56 PM
The product team itself no longer directly accepting feedback for Microsoft Visual Studio 2010 and earlier products. You can get support for issues with Visual Studio 2010 and earlier by visiting one of the resources in the link below:
http://msdn.microsoft.com/en-us/vstudio/cc136615.aspx
Posted by Microsoft on 1/4/2013 at 5: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.