public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/55774] New: AVX integer store segfault
@ 2012-12-21 12:42 gcc-bugzilla@ben-strasser.net
  2012-12-21 12:54 ` [Bug target/55774] " jakub at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: gcc-bugzilla@ben-strasser.net @ 2012-12-21 12:42 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55774
           Summary: AVX integer store segfault
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gcc-bugzilla@ben-strasser.net


The following code segfaults

#include <immintrin.h>

int main(){
    unsigned a[8] = {0x22222222u, 0xAAAAAAAAu, 0x11111111u, 0x33333333u,
0xDEADBEAFu, 0xFAAAAAAAu, 0xDEADBEAFu, 0xFAAAAAAAu};
    unsigned b[8];

    __m256i x = _mm256_load_si256((__m256i*)a);
    _mm256_store_si256((__m256i*)b, x);
}

when compiled with 

g++ -mavx mini.cpp -o mini && ./mini

The output of g++ -S is

    .file    "mini.cpp"
    .text
    .globl    main
    .type    main, @function
main:
.LFB707:
    .cfi_startproc
    pushq    %rbp
    .cfi_def_cfa_offset 16
    .cfi_offset 6, -16
    movq    %rsp, %rbp
    .cfi_def_cfa_register 6
    andq    $-32, %rsp
    subq    $40, %rsp
    movl    $572662306, -40(%rsp)
    movl    $-1431655766, -36(%rsp)
    movl    $286331153, -32(%rsp)
    movl    $858993459, -28(%rsp)
    movl    $-559038801, -24(%rsp)
    movl    $-89478486, -20(%rsp)
    movl    $-559038801, -16(%rsp)
    movl    $-89478486, -12(%rsp)
    leaq    -40(%rsp), %rax
    movq    %rax, 24(%rsp)
    movq    24(%rsp), %rax
    vmovdqa    (%rax), %ymm0
    vmovdqa    %ymm0, -120(%rsp)
    leaq    -8(%rsp), %rax
    movq    %rax, 32(%rsp)
    vmovdqa    -120(%rsp), %ymm0
    vmovdqa    %ymm0, -88(%rsp)
    movq    32(%rsp), %rax
    vmovdqa    -88(%rsp), %ymm0
    vmovdqa    %ymm0, (%rax)
    movl    $0, %eax
    leave
    .cfi_def_cfa 7, 8
    ret
    .cfi_endproc
.LFE707:
    .size    main, .-main
    .ident    "GCC: (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3"
    .section    .note.GNU-stack,"",@progbits




My GCC version is: g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3


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

* [Bug target/55774] AVX integer store segfault
  2012-12-21 12:42 [Bug target/55774] New: AVX integer store segfault gcc-bugzilla@ben-strasser.net
@ 2012-12-21 12:54 ` jakub at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-12-21 12:54 UTC (permalink / raw)
  To: gcc-bugs


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jakub at gcc dot gnu.org
         Resolution|                            |INVALID

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-12-21 12:53:46 UTC ---
That is user error.  You aren't making sure a and b arrays are sufficiently
aligned, thus you need to use _mm256_loadu_si256 and _mm256_storeu_si256
instead (or make those arrays aligned, e.g. with __attribute__((aligned (32))).


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

end of thread, other threads:[~2012-12-21 12:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-21 12:42 [Bug target/55774] New: AVX integer store segfault gcc-bugzilla@ben-strasser.net
2012-12-21 12:54 ` [Bug target/55774] " jakub 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).