Note that there are some explanatory texts on larger screens.

plurals
  1. POQt, GCC, SSE and stack alignment
    text
    copied!<p>I'm trying to make a program compiled with GCC and using Qt and SSE intrinsics. It seems that when one of my functions is called by Qt, the stack alignment is not preserved. Here's a short example to illustrate what I mean :</p> <pre><code>#include &lt;cstdio&gt; #include &lt;emmintrin.h&gt; #include &lt;QtGui/QApplication.h&gt; #include &lt;QtGui/QWidget.h&gt; class Widget: public QWidget { public: void paintEvent(QPaintEvent *) { __m128 a; printf("a: 0x%08x\n", ((void *) &amp;a)); } }; int main(int argc, char** argv) { QApplication application(argc, argv); Widget w; w.paintEvent(NULL); // Called from here, my function behaves correctly w.show(); w.update(); // Qt will call Widget::paintEvent and my __m128 will not be // aligned on 16 bytes as it should application.processEvents(); return 0; } </code></pre> <p>Here's the output:</p> <pre><code>a: 0x0023ff40 // OK, that's aligned on 16 bytes a: 0x0023d14c // Not aligned! </code></pre> <p>Configuration:</p> <ul> <li>Intel Core2</li> <li>WinXP, SP3</li> <li>GCC 4.4 (Mingw included in the Qt SDK 2010.01)</li> </ul> <p>I tried to compile the example program with the same options as those I saw in the Qt makefile :</p> <pre><code>-O2 -Wall -frtti -fexceptions -mthreads </code></pre> <p>,link options:</p> <pre><code>-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -mthreads </code></pre> <p>Now I don't know in which directions to search. Any hints would be appreciated. Thanks!</p> <p>Fabien</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload