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 target/16890] [cygwin/mingw32] __m128 automatic variables misaligned


------- Additional Comments From matt dot daws at cantab dot net  2004-08-18 17:41 -------
I have access to a linux box with "gcc -v" giving:

Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

Sorry, it's not mine though, so I cannot update.  I cannot replicate the
segfault, but the assembly output is again the same (indeed, it seems identical
to the code Danny gave).

I have inserted the following:

   unsigned int aa,bb;
   asm("movl %%esp,%%eax; movl %%ebp,%%ebx;" : "=a"(aa), "=b"(bb) );
   printf("ESP=%u (%u), EBP=%u (%u).\n",aa,aa&15,bb,bb&15);

Which tells us what ESP and EBP are.  Under linux, EBP is always 8 mod 16, as
expected.  Under Windows, this only true when foo() is a separate function,
while in main(), EBP is 0 mod 16, leading to unaligned accesses.

I suspect that this is a MinGW issue, though I really don't know enough about
how MinGW interacts with Windows...  I would guess that the internal code which
calls main() needs altering so that ESP is 0 mod 16 before the supposed "call
_main" instruction.

--Matt

-- 


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


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