public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/59163] [4.8/4.9 Regression] program compiled with g++ -O3 segfaults
Date: Fri, 29 Nov 2013 10:34:00 -0000	[thread overview]
Message-ID: <bug-59163-4-XVgvhKgj38@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-59163-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |uros at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Looks like it, yes.
In *.jump we still have (IMHO correct):
(insn 2 4 3 2 (set (reg/v/f:DI 89 [ a ])
        (reg:DI 5 di [ a ])) pr59163-2.C:13 85 {*movdi_internal}
     (nil))
(note 3 2 6 2 NOTE_INSN_FUNCTION_BEG)
(insn 6 3 7 2 (set (reg:TI 90)
        (mem:TI (reg/v/f:DI 89 [ a ]) [3 MEM[(const struct A &)a_4(D)]+0 S16
A32])) pr59163-2.C:15 84 {*movti_internal}
     (nil))
(insn 7 6 8 2 (set (mem/c:TI (plus:DI (reg/f:DI 20 frame)
                (const_int -16 [0xfffffffffffffff0])) [3 c+0 S16 A128])
        (reg:TI 90)) pr59163-2.C:15 84 {*movti_internal}
     (nil))
...
(insn 9 8 10 2 (set (reg:V4SF 91 [ vect__7.10 ])
        (mult:V4SF (reg:V4SF 92)
            (mem/c:V4SF (plus:DI (reg/f:DI 20 frame)
                    (const_int -16 [0xfffffffffffffff0])) [2 MEM[(float *)&c]+0
S16 A128]))) pr59163-2.C:17 1269 {*mulv4sf3}
     (nil))

movti_internal handles unaligned loads properly.
Then *.dse1 transforms this into:
(insn 6 3 18 2 (set (reg:TI 90 [ MEM[(const struct A &)a_4(D)] ])
        (mem:TI (reg/v/f:DI 89 [ a ]) [3 MEM[(const struct A &)a_4(D)]+0 S16
A32])) pr59163-2.C:15 84 {*movti_internal}
     (nil))
(insn 18 6 8 2 (set (reg:V4SF 94)
        (subreg:V4SF (reg:TI 90 [ MEM[(const struct A &)a_4(D)] ]) 0))
pr59163-2.C:15 -1
     (expr_list:REG_DEAD (reg:TI 90 [ MEM[(const struct A &)a_4(D)] ])
        (nil)))
...
(insn 9 8 19 2 (set (reg:V4SF 91 [ vect__7.10 ])
        (mult:V4SF (reg:V4SF 92)
            (reg:V4SF 94))) pr59163-2.C:17 1269 {*mulv4sf3}
     (expr_list:REG_DEAD (reg:V4SF 94)
        (expr_list:REG_DEAD (reg:V4SF 92)
            (nil))))
which also looks ok to me.  But then combine combines it into:
(insn 9 8 19 2 (set (reg:V4SF 91 [ vect__7.10 ])
        (mult:V4SF (reg:V4SF 92)
            (mem:V4SF (reg/v/f:DI 89 [ a ]) [3 MEM[(const struct A &)a_4(D)]+0
S16 A32]))) pr59163-2.C:17 1269 {*mulv4sf3}
     (expr_list:REG_DEAD (reg:V4SF 92)
        (nil)))
which is wrong (for pre-AVX), because mulv4sf3 can't accept unaligned memory.
Likely the SSEx pre-AVX predicates assume that an unaligned vector load will be
done using UNSPEC and thus not really mergeable here, and don't count with the
fact that the load could be done using integral mode and just subreged into
vector mode.  Perhaps we need new predicates for this that would fail for
exactly this situation (disallow unaligned scalar load subregged into vector
mode for pre-AVX) and use them everywhere where SSE? doesn't accept unaligned
loads?


  parent reply	other threads:[~2013-11-29 10:34 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-17 22:44 [Bug c++/59163] New: " donnyjward at gmail dot com
2013-11-18 10:49 ` [Bug rtl-optimization/59163] " redi at gcc dot gnu.org
2013-11-18 11:41 ` [Bug rtl-optimization/59163] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
2013-11-21 14:49 ` [Bug tree-optimization/59163] " rguenth at gcc dot gnu.org
2013-11-29  8:16 ` jakub at gcc dot gnu.org
2013-11-29  8:52 ` jakub at gcc dot gnu.org
2013-11-29  9:22 ` [Bug target/59163] " rguenth at gcc dot gnu.org
2013-11-29 10:34 ` jakub at gcc dot gnu.org [this message]
2013-11-29 12:57 ` ubizjak at gmail dot com
2013-11-29 13:43 ` ubizjak at gmail dot com
2013-11-29 14:38 ` jakub at gcc dot gnu.org
2013-11-29 16:28 ` ubizjak at gmail dot com
2013-11-29 16:39 ` ubizjak at gmail dot com
2013-11-29 16:57 ` jakub at gcc dot gnu.org
2013-11-29 18:14 ` ubizjak at gmail dot com
2013-11-29 19:56 ` ubizjak at gmail dot com
2013-11-29 20:28 ` jakub at gcc dot gnu.org
2013-11-29 20:54 ` jakub at gcc dot gnu.org
2013-11-30  7:14 ` jakub at gcc dot gnu.org
2013-11-30  9:59 ` ubizjak at gmail dot com
2013-12-04 11:11 ` jakub at gcc dot gnu.org
2013-12-04 11:12 ` jakub at gcc dot gnu.org
2013-12-04 15:51 ` jakub at gcc dot gnu.org
2013-12-04 15:55 ` jakub at gcc dot gnu.org
2013-12-10  7:50 ` 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-59163-4-XVgvhKgj38@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).