public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/51955] New: _mm_setzero_si128 intri causes segfault without -O
@ 2012-01-23  1:57 graphitem at gmail dot com
  2012-01-23  2:44 ` [Bug c/51955] _mm_setzero_si128 intrinsic " graphitem at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: graphitem at gmail dot com @ 2012-01-23  1:57 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51955

             Bug #: 51955
           Summary: _mm_setzero_si128 intri causes segfault without -O
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: graphitem@gmail.com


Created attachment 26419
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26419
gcc -v -save-temps output

There seems to be an issue in respect to the _mm_setzero_si128() intrinsic in
<emmintrin.h>
using the following __m128i xmm0 = _mm_setzero_si128(); causes a segmentation
fault. GDB reports the following
Program received signal SIGSEGV, Segmentation fault.
0x0000000000400631 in _mm_setzero_si128 () at
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.2/include/emmintrin.h:734
734      return __extension__ (__m128i)(__v4si){ 0, 0, 0, 0 };

The bug seems to dissapear when optimization levels 1,2,3 are used.
The compiler flags I'm using:
-Wall -nostdlib -std=c99 -fno-builtin -ffreestanding -pedantic-errors

GCC version and specs are below:

gcc -v:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/src/gcc-4.6-20111223/configure --prefix=/usr
--libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-clocale=gnu --enable-gnu-unique-object
--enable-linker-build-id --with-ppl --enable-cloog-backend=isl --enable-lto
--enable-gold --enable-ld=default --enable-plugin --with-plugin-ld=ld.gold
--enable-multilib --disable-libssp --disable-libstdcxx-pch
--enable-checking=release --with-fpmath=sse
Thread model: posix
gcc version 4.6.2 20111223 (prerelease) (GCC) 


uname -a:
Linux (graphitemaster) 3.1.9-2-ARCH #1 SMP PREEMPT Sat Jan 14 09:11:37 CET 2012
x86_64 AMD Phenom(tm) AuthenticAMD GNU/Linux


attached is the gcc -v -save-temps output


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/51955] _mm_setzero_si128 intrinsic causes segfault without -O
  2012-01-23  1:57 [Bug c/51955] New: _mm_setzero_si128 intri causes segfault without -O graphitem at gmail dot com
@ 2012-01-23  2:44 ` graphitem at gmail dot com
  2012-01-23  2:54 ` graphitem at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: graphitem at gmail dot com @ 2012-01-23  2:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51955

--- Comment #1 from Dale Weiler <graphitem at gmail dot com> 2012-01-23 01:53:51 UTC ---
Created attachment 26420
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26420
Test case

This is a working test case which will cause the segmentation fault.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/51955] _mm_setzero_si128 intrinsic causes segfault without -O
  2012-01-23  1:57 [Bug c/51955] New: _mm_setzero_si128 intri causes segfault without -O graphitem at gmail dot com
  2012-01-23  2:44 ` [Bug c/51955] _mm_setzero_si128 intrinsic " graphitem at gmail dot com
@ 2012-01-23  2:54 ` graphitem at gmail dot com
  2012-01-23  3:18 ` [Bug target/51955] " pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: graphitem at gmail dot com @ 2012-01-23  2:54 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51955

--- Comment #2 from Dale Weiler <graphitem at gmail dot com> 2012-01-23 01:57:00 UTC ---
Created attachment 26421
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26421
objdump -d (dissasembly)

This is a dissasembly of the generated assembly from the following testcase. 
There seems to be nothing out of the ordinary that could be causing the
segmentation fault.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/51955] _mm_setzero_si128 intrinsic causes segfault without -O
  2012-01-23  1:57 [Bug c/51955] New: _mm_setzero_si128 intri causes segfault without -O graphitem at gmail dot com
  2012-01-23  2:44 ` [Bug c/51955] _mm_setzero_si128 intrinsic " graphitem at gmail dot com
  2012-01-23  2:54 ` graphitem at gmail dot com
@ 2012-01-23  3:18 ` pinskia at gcc dot gnu.org
  2012-01-23  7:24 ` graphitem at gmail dot com
  2012-01-23 10:54 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-23  3:18 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51955

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-23 02:38:46 UTC ---
This is a bug in how your _start does not realign the stack to 16 byte aligned.
    movdqa    %xmm0, -32(%rbp)
    movdqa    -32(%rbp), %xmm0
    movdqa    %xmm0, -16(%rbp)

rbp            0x7fffffffe388    0x7fffffffe388
rsp            0x7fffffffe388    0x7fffffffe388


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/51955] _mm_setzero_si128 intrinsic causes segfault without -O
  2012-01-23  1:57 [Bug c/51955] New: _mm_setzero_si128 intri causes segfault without -O graphitem at gmail dot com
                   ` (2 preceding siblings ...)
  2012-01-23  3:18 ` [Bug target/51955] " pinskia at gcc dot gnu.org
@ 2012-01-23  7:24 ` graphitem at gmail dot com
  2012-01-23 10:54 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: graphitem at gmail dot com @ 2012-01-23  7:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51955

--- Comment #4 from Dale Weiler <graphitem at gmail dot com> 2012-01-23 03:59:58 UTC ---
(In reply to comment #3)
> This is a bug in how your _start does not realign the stack to 16 byte aligned.
>     movdqa    %xmm0, -32(%rbp)
>     movdqa    -32(%rbp), %xmm0
>     movdqa    %xmm0, -16(%rbp)
> 
> rbp            0x7fffffffe388    0x7fffffffe388
> rsp            0x7fffffffe388    0x7fffffffe388

Interesting, even with alignment it crashes however:
while ((((intptr_t)data)&15))
  data++;

What exactly should be aligned the const char * for kill()?
I'm unsure to what you mean in regards to realigning the stack
for _just _start.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/51955] _mm_setzero_si128 intrinsic causes segfault without -O
  2012-01-23  1:57 [Bug c/51955] New: _mm_setzero_si128 intri causes segfault without -O graphitem at gmail dot com
                   ` (3 preceding siblings ...)
  2012-01-23  7:24 ` graphitem at gmail dot com
@ 2012-01-23 10:54 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-23 10:54 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51955

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-23 10:50:52 UTC ---
void _start() {
    main();
}

isn't properly aligning the stack for the ABI GCC assumes.  Simply drop it.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-01-23 10:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-23  1:57 [Bug c/51955] New: _mm_setzero_si128 intri causes segfault without -O graphitem at gmail dot com
2012-01-23  2:44 ` [Bug c/51955] _mm_setzero_si128 intrinsic " graphitem at gmail dot com
2012-01-23  2:54 ` graphitem at gmail dot com
2012-01-23  3:18 ` [Bug target/51955] " pinskia at gcc dot gnu.org
2012-01-23  7:24 ` graphitem at gmail dot com
2012-01-23 10:54 ` rguenth at gcc dot gnu.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).