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]

target/9290: incorrect alignment when using SSE on ia32


>Number:         9290
>Category:       target
>Synopsis:       incorrect alignment when using SSE on ia32
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 13 03:46:02 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     mark@cal005304.student.utwente.nl
>Release:        3.3 20030106 (prerelease)
>Organization:
>Environment:
i686-pc-linux-gnu
>Description:
I have been testing the __builtin_ia32_ sse functions on the gcc-3.3
compiler. For the most part the results look promising, except the
alignment is incorrect. See the attached example, I've tried everything I
could think of to get the alignment working. Line "1f" in the disassembly
causes a segfault.

compiled with:
gcc -march=pentium3 -msse -O3 -c sse_bug.cpp -mpreferred-stack-boundary=4

gcc-version:
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/specs
Configured with: ../gcc-20030106/configure
Thread model: posix
gcc version 3.3 20030106 (prerelease)

------ Source code --------------------------------------------------------
typedef int __m128 __attribute__ ((__mode__(__V4SF__)));

class sse_t {
        __m128 d __attribute__((aligned(16)));
public:
        sse_t();
        sse_t operator=(sse_t const &o) { d=o.d; }
};

class Contour { 
        sse_t test;
public:
        Contour();
}; 

Contour::Contour()
{
        sse_t z __attribute__ ((aligned(16)));

        test=z;
}

------ Resulting object code ------------------------------------------------
00000000 <_ZN7ContourC2Ev>:
   0:   55                      push   %ebp
   1:   89 e5                   mov    %esp,%ebp
   3:   83 ec 28                sub    $0x28,%esp
   6:   89 5d fc                mov    %ebx,0xfffffffc(%ebp)
   9:   8b 5d 08                mov    0x8(%ebp),%ebx
   c:   89 1c 24                mov    %ebx,(%esp,1)
   f:   e8 fc ff ff ff          call   10 <_ZN7ContourC2Ev+0x10>
  14:   8d 55 e8                lea    0xffffffe8(%ebp),%edx
  17:   89 14 24                mov    %edx,(%esp,1)
  1a:   e8 fc ff ff ff          call   1b <_ZN7ContourC2Ev+0x1b>
**1f:   0f 28 4d e8             movaps 0xffffffe8(%ebp),%xmm1   **
  23:   0f 29 0b                movaps %xmm1,(%ebx)
  26:   8b 5d fc                mov    0xfffffffc(%ebp),%ebx
  29:   89 ec                   mov    %ebp,%esp
  2b:   5d                      pop    %ebp
  2c:   c3                      ret    
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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