public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/27412] New: Incorrect result with sse intrinsic while extracting int
@ 2006-05-03 23:25 gcc at povworld dot org
2006-05-03 23:28 ` [Bug c++/27412] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: gcc at povworld dot org @ 2006-05-03 23:25 UTC (permalink / raw)
To: gcc-bugs
Following code sets a 4 32-bit int sse vector to 1 for all elements and
extracts one int out of the vector. g++ returns an incorrect result when
compiling with -O2 or -O3 but not with -O1 or -O0
// -----------------------
#include <stdio.h>
#include <emmintrin.h>
int main() {
__m128i ix = _mm_set1_epi32(1);
int res = ((int*)&ix)[1];
printf("results: %i\n", res);
}
// -----------------------
compiled with:
$ g++-4.1.0 -O2 -msse2
expected result: 1
actual result: -1209151480
similar misbehavior by gcc-3.4.5
acutal result: 134513897
$ g++-4.1.0 -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /var/tmp/portage/gcc-4.1.0/work/gcc-4.1.0/configure
--prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.1.0
--includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.1.0/include
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.0
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.0/man
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.0/info
--with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.1.0/include/g++-v4
--host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec
--enable-nls --without-included-gettext --with-system-zlib --disable-checking
--disable-werror --disable-libunwind-exceptions --disable-multilib
--disable-libmudflap --disable-libssp --enable-java-awt=gtk
--enable-languages=c,c++,java,fortran --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 4.1.0 (Gentoo 4.1.0)
--
Summary: Incorrect result with sse intrinsic while extracting int
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gcc at povworld dot org
GCC host triplet: i686 linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27412
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-05-03 23:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-03 23:25 [Bug c++/27412] New: Incorrect result with sse intrinsic while extracting int gcc at povworld dot org
2006-05-03 23:28 ` [Bug c++/27412] " pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).