public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/39908]  New: Aligned access to unaligned address
@ 2009-04-26 12:51 irar at il dot ibm dot com
  2009-04-26 16:54 ` [Bug tree-optimization/39908] " rguenth at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: irar at il dot ibm dot com @ 2009-04-26 12:51 UTC (permalink / raw)
  To: gcc-bugs

The following code (a reduced gcc.target/x86_64/abi/test_struct_returning.c)
fails during execution with segmentation fault when compiled with -O1
-ftree-vectorize -fno-vect-cost-model asm-support.S  (in directory
gcc.target/x86_64/abi/):

#include <stdio.h>
#include "defines.h"
#include "macros.h"
#include "args.h"

struct S_600
{
 float f[4];
};

struct S_600 f_600 ()
{
  struct S_600 s;
  int i;

  for (i = 0; i < 4; i++)
    s.f[i] = 42;
  return s;
}

int
main (void)
{
  struct S_600 s;
  s = WRAP_RET(f_600) ();

  return 0;
}

The failure occurs in 
0x000000000040063b in f_600 ()
1: x/i $pc  0x40063b <f_600+7>: movaps %xmm0,0xffffffffffffffd8(%rsp)
(gdb)

Program received signal SIGSEGV, Segmentation fault.
0x000000000040063b in f_600 ()
1: x/i $pc  0x40063b <f_600+7>: movaps %xmm0,0xffffffffffffffd8(%rsp)

rsp            0x7fff408944c0   0x7fff408944c0
xmm0           {v4_float = {0x2a, 0x2a, 0x2a, 0x2a}, v2_double = {0xc00002114,
0xc00002114}, v16_int8 = {0x0, 0x0, 0x28,
    0x42, 0x0, 0x0, 0x28, 0x42, 0x0, 0x0, 0x28, 0x42, 0x0, 0x0, 0x28, 0x42},
v8_int16 = {0x0, 0x4228, 0x0, 0x4228, 0x0,
    0x4228, 0x0, 0x4228}, v4_int32 = {0x42280000, 0x42280000, 0x42280000,
0x42280000}, v2_int64 = {0x4228000042280000,
    0x4228000042280000}, uint128 = 0x42280000422800004228000042280000}

The alignment is forced by the vectorizer in function
vect_compute_data_ref_alignment() the same way as in pass
pass_ipa_increase_alignment. But if 's' is global and not local in f_600 (i.e.,
when the alignment is forced in pass_ipa_increase_alignment) there is no
segfault.

I also tried to remove WRAP_RET(), and put f_600 and main in different files
(in order to prevent their elimination). But this way there was no segfault
either.

Another check: if the vectorizer forces alignment but also uses peeling (with
the help of a hack), there is still a segfault:
0x000000000040065f in f_600 ()
1: x/i $pc  0x40065f <f_600+43>:        movaps 362(%rip),%xmm0        #
0x4007d0 <_IO_stdin_used+16>
(gdb)

1: x/i $pc  0x400666 <f_600+50>:        movaps %xmm0,(%rdx)
(gdb)

Program received signal SIGSEGV, Segmentation fault.
0x0000000000400666 in f_600 ()
1: x/i $pc  0x400666 <f_600+50>:        movaps %xmm0,(%rdx)
(gdb) info all-registers

rdx            0x7fff2a759358   140733905736536
rip            0x400666 0x400666 <f_600+50>

If after forcing the alignment, the vectorizer escapes and doesn't do anything
else, there is no segfault.


-- 
           Summary: Aligned access to unaligned address
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: irar at il dot ibm dot com
 GCC build triplet: x86_64-suse-linux
  GCC host triplet: x86_64-suse-linux
GCC target triplet: x86_64-suse-linux


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


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

* [Bug tree-optimization/39908] Aligned access to unaligned address
  2009-04-26 12:51 [Bug tree-optimization/39908] New: Aligned access to unaligned address irar at il dot ibm dot com
@ 2009-04-26 16:54 ` rguenth at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-26 16:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2009-04-26 16:54 -------


*** This bug has been marked as a duplicate of 39907 ***


-- 

rguenth at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2009-04-26 16:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-26 12:51 [Bug tree-optimization/39908] New: Aligned access to unaligned address irar at il dot ibm dot com
2009-04-26 16:54 ` [Bug tree-optimization/39908] " rguenth 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).