Bug 9633 - [i386 SSE] SSE intrinsics generate wrong code when spilling xmm registers to stack
Summary: [i386 SSE] SSE intrinsics generate wrong code when spilling xmm registers to ...
Status: RESOLVED DUPLICATE of bug 10395
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.0
: P2 critical
Target Milestone: 3.4.0
Assignee: Bernd Schmidt
URL:
Keywords: wrong-code
: 12091 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-02-09 03:16 UTC by felix-gcc
Modified: 2003-08-29 16:00 UTC (History)
3 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2003-08-24 04:09:33


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description felix-gcc 2003-02-09 03:16:00 UTC
	When compiling SSE code without optimization (or when using it
	in a way that makes gcc think it needs to spill xmm registers to
	the stack), gcc will not make sure the stack is 16-byte aligned.
	That causes the SSE store instruction to generate a segmentation
	fault.  This behavior is in 3.1.1 (earliest I have) up to the
	current 3.4 CVS.

Release:
3.4 20030129 (experimental)

Environment:
System: Linux hellhound 2.4.20-wolk4.0s-pre7 #2 Wed Jan 22 13:14:55 CET 2003 i686 AMD Athlon(tm) XP 2000+ AuthenticAMD GNU/Linux
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ./configure --program-transform-name=s/^/e/ --prefix=/opt/gcc --with-local-prefix=/usr/local --disable-nls : (reconfigured) ./configure --program-transform-name=s/^/e/ --prefix=/opt/gcc --with-local-prefix=/usr/local --disable-nls --enable-__cxa_atexit

How-To-Repeat:
	$ cat ssebug.c
	#include <xmmintrin.h>

	main() {
	  static float scale=32768.f;
	  __m128 Scale=_mm_load1_ps(&scale);
	}
	$ gcc -o ssebug ssebug.c -msse
	$ ./ssebug
	[segfault]
Comment 1 felix-gcc 2003-02-09 03:16:00 UTC
Fix:
	align the stack variables.
	Since spilling to the stack in most cases negates the
	performance gain the programmer hopes for with SSE, I also
	suggest a compiler warning in this case.
Comment 2 Jan Hubicka 2003-04-08 13:12:01 UTC
Responsible-Changed-From-To: unassigned->bernds
Responsible-Changed-Why: Bernd, would be possible to look into the dynamic stack alignment?  I can try to prepare updated patches...
Comment 3 Jan Hubicka 2003-04-08 13:12:01 UTC
State-Changed-From-To: open->closed
State-Changed-Why: This is known problem with runtimes not aligning stack properly.  The frame of function main is missaligned, other functions works. Bernd has code for dynamic stack alignment, hope it will get applied one day
Comment 4 Nathanael C. Nerode 2003-05-23 05:19:04 UTC
Jan, we need to have a specific bug this is a duplicate of...
Comment 5 Andrew Pinski 2003-08-28 12:34:28 UTC
*** Bug 12091 has been marked as a duplicate of this bug. ***
Comment 6 Andrew Pinski 2003-08-29 16:00:36 UTC
This is a dup of bug 10395, it is a problem in main and in pthreads call-backs.

*** This bug has been marked as a duplicate of 10395 ***