Bug #2093

g++ failing on _mm_set1_epi32() (cc don't)

Added by masterblaster over 3 years ago. Updated over 3 years ago.

Status:ClosedStart date:
Priority:UrgentDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

Hi all,

successfully compiled lyx on v2.11.0.397.g4b06a0-DEVELOPMENT x86_64, but
cores at start.

Problem is in qt4-libs package,
qt-everywhere-opensource-src-4.7.2/src/corelib/tools/qstring.cpp
QString::Data *QString::fromLatin1_helper(), when using _mm_set1_epi32().

Compiling and running simple test program (containing the failing call)
with both cc and g++:

#include <smmintrin.h>
int main(int argc, char *argv[]) { __m128i a = _mm_set1_epi32(0); }

$ cc -msse4.2 t.c && ./a.out
$ g++ -msse4.2 t.c && ./a.out
Illegal instruction: 4 (core dumped)
$

Same result with -msse4.1 compiler option.

ByE!

History

#1 Updated by alexh over 3 years ago

Hi,

I've been bitten by the same problem, but your test case is bogus. You probably
don't have a CPU that supports SSE4.X, and should not be using the smmintrin.h
header but rather emmintrin.h or xmmintrin.h.

The real issue I'm not really sure what it is, but it's not an illegal
instruction, that's clear.

I'm raising the priority to critical because it breaks every desktop app,
basically. Xorg, gtk2, qt, pixman are affected by this issue.

Cheers,
Alex

#2 Updated by alexh over 3 years ago

From what I can see this is due to an unaligned access with movdqa, which can
only be used with quad-word aligned addresses:

faulting instruction:
movdqa -0x2c0(%rbp),%xmm0

registers:
rbp 0x7ffffffff3f8 0x7ffffffff3f8

Not sure why gcc is generating an unaligned access with MOVDQA.

#3 Updated by alexh over 3 years ago

Should be fixed in c7a4cde72d531a700a01278b1a3596efd362767d. Please let me know
if the problem persists.

#4 Updated by alexh over 3 years ago

I forgot to mention that you need to recompile whatever used that instruction;
so in this case it seems qt.

#5 Updated by masterblaster over 3 years ago

It works with reported test program, thanks!
I'll be on holiday next three weeks, will check it extensivele then asap.

Also available in: Atom PDF