public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "npozar at quick dot cz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/48659] New: Segmentation fault when using openMP and SSE
Date: Mon, 18 Apr 2011 06:59:00 -0000	[thread overview]
Message-ID: <bug-48659-4@http.gcc.gnu.org/bugzilla/> (raw)

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.


             reply	other threads:[~2011-04-18  6:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-18  6:59 npozar at quick dot cz [this message]
2011-04-18 12:22 ` [Bug c++/48659] " rguenth at gcc dot gnu.org
2013-01-26 14:04 ` [Bug target/48659] " redi at gcc dot gnu.org
2013-01-28 11:53 ` daniel.f.starke at freenet dot de

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-48659-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).