------- Comment #15 from yottui at yahoo dot co dot jp  2010-07-14 09:22 -------
I found the similar case with gcc 4.4.4 of MacPorts and gcc 4.4.0 of MinGW.

-- begin testcase --
// g++ -O -msse2 test.cpp
typedef long long __m128i __attribute__ ((__vector_size__ (16),
__may_alias__));

struct vec
{
        __m128i v;

        static vec load(const int * p)
        { return (__m128i) __builtin_ia32_loaddqu((char const *)p); }

        const int & operator [](int i) const
        {
                union u {
                        __m128i v;
                        int     e[4];
                };

                return ((const u &)v).e[i];
        }

        vec() {}
        vec(const __m128i & a) : v(a) {}
};

extern "C" {
        int  printf (const char*, ...);
}

int main( int argc, char * argv[] )
{
        __attribute__((aligned(16))) int data[] =
        { 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5 };

        vec a = vec::load(data);

        printf("v: %d, %d, %d, %d\n", a[0], a[1], a[2], a[3]);

        return 0;
}
-- end testcase --

-- begin output --
v: 16, 16, 14, 14
-- end output --


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44900

Reply via email to