public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/22229] New: Segfault due to unaligned movaps access
@ 2005-06-29 12:38 uros at kss-loka dot si
  2005-06-29 12:41 ` [Bug target/22229] " pluto at agmk dot net
  2005-07-09 16:47 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: uros at kss-loka dot si @ 2005-06-29 12:38 UTC (permalink / raw)
  To: gcc-bugs

This testcase segfaults due to unaligned movaps access when compiled with 'gcc -
O2 -msse':

--cut here--
#include <xmmintrin.h>

__m128 bar (__m128 x1, __m128 y1, __m128 x2, __m128 y2)
{
  return x1;
}

__m128 foo (__m128 x)
{
  return bar (x, x, x, x);
}

int main()
{
  __m128 a = {1.0, 2.0, 3.0, 4.0};

  union {
    __m128 _xmm;
    float x[4];
  } temp;

  temp._xmm = foo (a);

  printf("%f\n", temp.x[2]);
  return 0;
}
--cut here--

The problem is, that 4th parameter to bar is now passed on stack (this is 
specified by x86 ABI). Unfortunatelly, stack is not aligned correctly and 
testcase segfaults in foo():

foo:
	subss	%xmm1, %xmm0
	pushl	%ebp
	movl	%esp, %ebp
	subl	$16, %esp
	movaps	%xmm0, (%esp)         <<<< here
	movaps	%xmm0, %xmm2
	movaps	%xmm0, %xmm1
	call	bar
	leave
	ret

Value of %esp is 0xbffff958 at the point of segfault.

-- 
           Summary: Segfault due to unaligned movaps access
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: ssemmx
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: uros at kss-loka dot si
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/22229] Segfault due to unaligned movaps access
  2005-06-29 12:38 [Bug target/22229] New: Segfault due to unaligned movaps access uros at kss-loka dot si
@ 2005-06-29 12:41 ` pluto at agmk dot net
  2005-07-09 16:47 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pluto at agmk dot net @ 2005-06-29 12:41 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pluto at agmk dot net


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/22229] Segfault due to unaligned movaps access
  2005-06-29 12:38 [Bug target/22229] New: Segfault due to unaligned movaps access uros at kss-loka dot si
  2005-06-29 12:41 ` [Bug target/22229] " pluto at agmk dot net
@ 2005-07-09 16:47 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-09 16:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-09 16:45 -------
Fixed by:
2005-07-07  Richard Henderson  <rth@redhat.com>
        
        * function.c (locate_and_pad_parm): Record parameter alignment in
        stack_alignment_needed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.1.0


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-07-09 16:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-29 12:38 [Bug target/22229] New: Segfault due to unaligned movaps access uros at kss-loka dot si
2005-06-29 12:41 ` [Bug target/22229] " pluto at agmk dot net
2005-07-09 16:47 ` pinskia at gcc dot gnu dot org

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).