GCCでコンパイルされ、QtとSSEの組み込み関数を使用してプログラムを作成しようとしています。私の関数の1つがQtによって呼び出された場合、スタックの配置が保持されないようです。これが私が何を意味するかを説明するための短い例です:
#include <cstdio>
#include <emmintrin.h>
#include <QtGui/QApplication.h>
#include <QtGui/QWidget.h>
class Widget: public QWidget {
public:
void paintEvent(QPaintEvent *) {
__m128 a;
printf("a: 0x%08x\n", ((void *) &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;
}
出力は次のとおりです。
a: 0x0023ff40 // OK, that's aligned on 16 bytes
a: 0x0023d14c // Not aligned!
構成:
- Intel Core2
- WinXP、SP3
- GCC 4.4(Qt SDK 2010.01に含まれるMingw)
Qtmakefileで見たものと同じオプションを使用してサンプルプログラムをコンパイルしようとしました。
-O2 -Wall -frtti -fexceptions -mthreads
、リンクオプション:
-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -mthreads
今、私はどの方向に検索するべきかわかりません。ヒントをいただければ幸いです。ありがとう!
ファビアン