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



             Bug #: 56487

           Summary: SSE2 code crashes when compiled at -O0 -m32 -msse2

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: target

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: dhaze...@yahoo.com





The following code (simplified from an SSE testcase0 crashes when compiled with

-m32 -msse2 -O0 on all gcc 4.x versions including mainline.  With optimization

enabled, or with gcc 3.x, it executes successfully.  Host/target is

x86_64-unknown-linux-gnu.



$ gcc-trunk --version

gcc-trunk (GCC) 4.8.0 20130228 (experimental) [trunk revision 196339]

$ gcc-trunk -m32 -msse2 -O1 sse-isamax.c 

$ ./a.out 

$ gcc-trunk -m32 -msse2 -O0 sse-isamax.c 

$ ./a.out 

Segmentation fault (core dumped)

$ cat sse-isamax.c 



typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));

typedef float __v4sf __attribute__ ((__vector_size__ (16)));

extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__,

__artificial__))

_mm_load_ps (float const *__P)

{

  return (__m128) *(__v4sf *)__P;

}

void exit(int);



int isamax0(float *x)

{

  __m128 V0;



  V0 = _mm_load_ps(x);

  exit(0);



  return (int)(*x + 4);

}



int main()

{



  float x[4];

  int i;

  for(i=0;i<4;i++)

     x[i] = -2.0 + (float) i;



  return isamax0(x);

}

Reply via email to