This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/48659] New: Segmentation fault when using openMP and SSE


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

           Summary: Segmentation fault when using openMP and SSE
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: npozar@quick.cz


Created attachment 24026
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24026
A code snippet that reproduces the error

g++ tries to save an xmm register using MOVAPD (SSE instruction) to the stack
when switching between working chunks during openMP multithreading. This
obviously causes a random segmentation fault when the stack pointer happens not
be aligned to a 16-byte boundary. 

Please see the attached code. I compile it with g++ 4.5.2 (I'm using MinGW) and
flags -O3 -msse3 -fopenmp.

It is important that the optimization is on and the compiler tries to save the
xmm register containing the constant zero between working chunks. This is the
instruction that causes the segmentation fault if ebp-0x48 is not divisible by
0x10:

0040143a:   movapd %xmm1,-0x48(%ebp) // right here
0040143f:   call 0x4014bc <GOMP_loop_dynamic_next>



PS. I have to admit that I'm completely new to GCC, openMP or SSE (I just
learned about openMP today and I've playing with them for a couple hours only),
so I might be just doing something really stupid.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]