Bug 46554

Summary: 0.24.4 - Crash when SSE2 is enabled
Product: pixman Reporter: mario753
Component: pixmanAssignee: Søren Sandmann Pedersen <soren.sandmann>
Status: RESOLVED NOTOURBUG QA Contact: Søren Sandmann Pedersen <soren.sandmann>
Severity: normal    
Priority: medium    
Version: 0.20.x   
Hardware: x86 (IA32)   
OS: Windows (All)   
Whiteboard:
i915 platform: i915 features:

Description mario753 2012-02-23 19:30:27 UTC
Hello

I compiled a static library from the pixman 0.24.4 sources using MSVC 8.0 (2005 SP1).  Initially I tried defining both USE_SSE2 and USE_X86_MMX.  After linking with Cairo 1.10.2 and trying the simple example given in the Cairo FAQ, I found that the program crashed in cairo_show_text.

Tracing with ollydbg, the offending instruction was of the "MOVQ ..." variety.  It caused an access violation as the source address was "FFFFFFFF".  After finding that this could relate to either MMX or SSE2 operations I recompiled pixman without MMX, relinked against Cairo, but this had no effect.  Then I tried compiling with MMX but without SSE2 - no more crashing, output as expected.

My CPU is an Intel Atom N270.  It's slow, but it's not that far behind the times that it can't support SSE2.  My gut feeling is that the compiler hasn't done something right, most likely as the source is geared more towards gcc.

Any ideas?
Comment 1 mario753 2012-02-26 15:41:16 UTC
Compiling a debug build results in the fault being identified within in_over_1x128.

Reading around, I found this bug over at Mozilla (https://bugzilla.mozilla.org/show_bug.cgi?id=640250) which describes my problem exactly, disassembly and all.  The question is, can anything be done about MSVC failing to align the stack for 16 bytes?
Comment 2 Søren Sandmann Pedersen 2012-02-26 18:34:27 UTC
It looks like Mozilla's solution was to always compile with optimization:

   +ifneq (,$(filter 1400 1500, $(_MSC_VER)))
   +# MSVC 2005 and 2008 generate code that breaks alignment
   +# restrictions in debug mode so always optimize.
   +# See bug 640250 for more info.
   +SSE2_CFLAGS=-O2
Comment 3 mario753 2012-02-27 10:02:12 UTC
It was and it does. :)
Thanks!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.