public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/65450] New: [5.0 Regression]: Unaligned access with -O3 -mtune=k8
Date: Tue, 17 Mar 2015 09:37:00 -0000	[thread overview]
Message-ID: <bug-65450-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65450

            Bug ID: 65450
           Summary: [5.0 Regression]: Unaligned access with -O3 -mtune=k8
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ubizjak at gmail dot com

The compiler generates unaligned access for Polyhedron channel.f90 test when
compiled with -O2 -mtune=k8:

/home/uros/gcc-build/gcc/gfortran -B/home/uros/gcc-build/gcc
-B/home/uros/gcc-build/x86_64-unknown-linux-gnu/libgfortran/ 
-B/home/uros/gcc-build/x86_64-unknown-linux-gnu/libquadmath/.libs
-L/home/uros/gcc-build/x86_64-unknown-linux-gnu/libgfortran/.libs
-L-L/home/uros/gcc-build/x86_64-unknown-linux-gnu/libquadmath/.libs -O2
-ffast-math -mtune=k8 channel.f90

LD_LIBRARY_PATH=/home/uros/gcc-build/gcc:/home/uros/gcc-build/x86_64-unknown-linux-gnu/libgfortran/.libs:/home/uros/gcc-build/x86_64-unknown-linux-gnu/libquadmath/.libs
./a.out

...
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x2AC9058B3C27
#1  0x2AC9058B2E20
#2  0x31CDC3002F
#3  0x402AFB in ddx at channel.f90:247
Segmentation fault

(gdb) r
...
Program received signal SIGSEGV, Segmentation fault.
0x0000000000402afb in ddx (array=..., __result=...) at channel.f90:247
247         ddx(2:I-1,1:J) = array(3:I,1:J)-array(1:I-2,1:J)    ! interior
points

(gdb) bt
#0  0x0000000000402afb in ddx (array=..., __result=...) at channel.f90:247
#1  sw () at channel.f90:148
#2  0x0000000000404cfd in main (argc=<optimized out>, argv=<optimized out>) at
channel.f90:234
#3  0x00000031cdc1d9f4 in __libc_start_main () from /lib64/libc.so.6
#4  0x0000000000400909 in _start ()

(gdb) disass
   ...
   0x0000000000402acc <+7644>:  movaps %xmm4,-0x20(%rdx)
   0x0000000000402ad0 <+7648>:  movlpd -0x10(%rax),%xmm0
   0x0000000000402ad5 <+7653>:  movhpd -0x8(%rax),%xmm0
   0x0000000000402ada <+7658>:  movapd %xmm0,%xmm4
   0x0000000000402ade <+7662>:  subpd  %xmm3,%xmm4
   0x0000000000402ae2 <+7666>:  movaps %xmm4,-0x10(%rdx)
   0x0000000000402ae6 <+7670>:  cmp    $0xf4,%rdi
   0x0000000000402aed <+7677>:  jne    0x402a71 <sw+7553>
   0x0000000000402aef <+7679>:  lea    0x20(%rcx),%rdi
   0x0000000000402af3 <+7683>:  add    $0x20,%rax
   0x0000000000402af7 <+7687>:  add    $0x20,%rdx
=> 0x0000000000402afb <+7691>:  movapd -0x20(%rax),%xmm3
   0x0000000000402b00 <+7696>:  mov    $0xf6,%r11d
   0x0000000000402b06 <+7702>:  xor    %ecx,%ecx
   0x0000000000402b08 <+7704>:  movapd %xmm3,%xmm4
   0x0000000000402b0c <+7708>:  subpd  %xmm0,%xmm4
   ...

(gdb) p/x $rax
$3 = 0x8c5a38

The failure can also be seen on SUSE gcc tester [1].

[1] http://gcc.opensuse.org/c++bench/polyhedron/polyhedron-performance-latest


             reply	other threads:[~2015-03-17  9:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-17  9:37 ubizjak at gmail dot com [this message]
2015-03-17  9:38 ` [Bug fortran/65450] " ubizjak at gmail dot com
2015-03-17 10:00 ` ubizjak at gmail dot com
2015-03-17 10:14 ` dominiq at lps dot ens.fr
2015-03-17 10:22 ` ubizjak at gmail dot com
2015-03-17 10:39 ` jakub at gcc dot gnu.org
2015-03-17 12:42 ` trippels at gcc dot gnu.org
2015-03-17 12:44 ` trippels at gcc dot gnu.org
2015-03-17 12:57 ` dominiq at lps dot ens.fr
2015-03-17 13:24 ` jakub at gcc dot gnu.org
2015-03-17 14:15 ` [Bug fortran/65450] [4.9 5.0 " ubizjak at gmail dot com
2015-03-17 18:06 ` [Bug fortran/65450] [4.9/5 " jakub at gcc dot gnu.org
2015-03-17 21:29 ` jakub at gcc dot gnu.org
2015-03-18  9:00 ` jakub at gcc dot gnu.org
2015-03-18 10:49 ` [Bug tree-optimization/65450] " jakub at gcc dot gnu.org
2015-03-18 11:33 ` rguenth at gcc dot gnu.org
2015-03-18 13:29 ` rguenth at gcc dot gnu.org
2015-03-18 13:54 ` jakub at gcc dot gnu.org
2015-03-18 13:56 ` [Bug tree-optimization/65450] [4.9 " jakub at gcc dot gnu.org
2015-06-03 15:28 ` jakub at gcc dot gnu.org
2015-06-03 21:43 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-65450-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).