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 rtl-optimization/66865] [6 Regression] wine64 segfaults from gcc in trunk (r225757) (regression)
Date: Wed, 15 Jul 2015 09:31:00 -0000	[thread overview]
Message-ID: <bug-66865-4-jxjS37XFl4@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-66865-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #13 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to kugan from comment #12)

> Thanks. I can now reproduce it. However, If I just use the changes to
> gcc/postreload.c (changes for bug 66838), I can get the trunk to work.

I can confrim this with [trunk revision 225805], please see insn @9c, it
reloads %rsi.

0000000000000010 <RtlConvertSidToUnicodeString>:
  10:   55                      push   %rbp
  11:   57                      push   %rdi
  12:   31 c0                   xor    %eax,%eax
  14:   56                      push   %rsi
  15:   53                      push   %rbx
  16:   48 89 d3                mov    %rdx,%rbx
  19:   48 8d 35 00 00 00 00    lea    0(%rip),%rsi        # 20
<RtlConvertSidToUnicodeString+0x10>
                        1c: R_X86_64_PC32       .rodata+0xfffffffffffffffc
  20:   48 81 ec 08 02 00 00    sub    $0x208,%rsp
  27:   0f 29 b4 24 60 01 00    movaps %xmm6,0x160(%rsp)
  2e:   00 
  2f:   48 89 e7                mov    %rsp,%rdi
  32:   48 89 e5                mov    %rsp,%rbp
  35:   0f 29 bc 24 70 01 00    movaps %xmm7,0x170(%rsp)
  3c:   00 
  3d:   44 0f 29 84 24 80 01    movaps %xmm8,0x180(%rsp)
  44:   00 00 
  46:   44 0f 29 8c 24 90 01    movaps %xmm9,0x190(%rsp)
  4d:   00 00 
  4f:   44 0f 29 94 24 a0 01    movaps %xmm10,0x1a0(%rsp)
  56:   00 00 
  58:   44 0f 29 9c 24 b0 01    movaps %xmm11,0x1b0(%rsp)
  5f:   00 00 
  61:   44 0f 29 a4 24 c0 01    movaps %xmm12,0x1c0(%rsp)
  68:   00 00 
  6a:   44 0f 29 ac 24 d0 01    movaps %xmm13,0x1d0(%rsp)
  71:   00 00 
  73:   44 0f 29 b4 24 e0 01    movaps %xmm14,0x1e0(%rsp)
  7a:   00 00 
  7c:   44 0f 29 bc 24 f0 01    movaps %xmm15,0x1f0(%rsp)
  83:   00 00 
  85:   0f b6 12                movzbl (%rdx),%edx
  88:   e8 00 00 00 00          callq  8d <RtlConvertSidToUnicodeString+0x7d>
                        89: R_X86_64_PLT32      sprintfW+0xfffffffffffffffc
  8d:   0f b6 53 03             movzbl 0x3(%rbx),%edx
  91:   0f b6 4b 04             movzbl 0x4(%rbx),%ecx
  95:   48 98                   cltq   
  97:   48 8d 7c 45 00          lea    0x0(%rbp,%rax,2),%rdi
  9c:   48 8d 35 00 00 00 00    lea    0(%rip),%rsi        # a3
<RtlConvertSidToUnicodeString+0x93>
                        9f: R_X86_64_PC32       .rodata+0xfffffffffffffffc
  a3:   31 c0                   xor    %eax,%eax
  a5:   c1 e2 08                shl    $0x8,%edx
  a8:   09 ca                   or     %ecx,%edx
  aa:   0f b6 4b 05             movzbl 0x5(%rbx),%ecx
  ae:   c1 e2 10                shl    $0x10,%edx
  b1:   c1 e1 08                shl    $0x8,%ecx
  b4:   0f b7 c9                movzwl %cx,%ecx
  b7:   09 ca                   or     %ecx,%edx
  b9:   e8 00 00 00 00          callq  be <RtlConvertSidToUnicodeString+0xae>
                        ba: R_X86_64_PLT32      sprintfW+0xfffffffffffffffc
  be:   0f 28 b4 24 60 01 00    movaps 0x160(%rsp),%xmm6
  c5:   00 
  c6:   0f 28 bc 24 70 01 00    movaps 0x170(%rsp),%xmm7
  cd:   00 
  ce:   44 0f 28 84 24 80 01    movaps 0x180(%rsp),%xmm8
  d5:   00 00 
  d7:   44 0f 28 8c 24 90 01    movaps 0x190(%rsp),%xmm9
  de:   00 00 
  e0:   44 0f 28 94 24 a0 01    movaps 0x1a0(%rsp),%xmm10
  e7:   00 00 
  e9:   44 0f 28 9c 24 b0 01    movaps 0x1b0(%rsp),%xmm11
  f0:   00 00 
  f2:   44 0f 28 a4 24 c0 01    movaps 0x1c0(%rsp),%xmm12
  f9:   00 00 
  fb:   44 0f 28 ac 24 d0 01    movaps 0x1d0(%rsp),%xmm13
 102:   00 00 
 104:   44 0f 28 b4 24 e0 01    movaps 0x1e0(%rsp),%xmm14
 10b:   00 00 
 10d:   44 0f 28 bc 24 f0 01    movaps 0x1f0(%rsp),%xmm15
 114:   00 00 
 116:   48 81 c4 08 02 00 00    add    $0x208,%rsp
 11d:   5b                      pop    %rbx
 11e:   5e                      pop    %rsi
 11f:   5f                      pop    %rdi
 120:   5d                      pop    %rbp
 121:   c3                      retq
>From gcc-bugs-return-492315-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Jul 15 09:35:38 2015
Return-Path: <gcc-bugs-return-492315-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 53697 invoked by alias); 15 Jul 2015 09:35:38 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 53679 invoked by uid 48); 15 Jul 2015 09:35:34 -0000
From: "konstantin.vladimirov at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/66876] New: vrp: changing unsigned to signed comparison
Date: Wed, 15 Jul 2015 09:35:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 5.1.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: konstantin.vladimirov at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone
Message-ID: <bug-66876-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-07/txt/msg01205.txt.bz2
Content-length: 1757

https://gcc.gnu.org/bugzilla/show_bug.cgi?idf876

            Bug ID: 66876
           Summary: vrp: changing unsigned to signed comparison
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: konstantin.vladimirov at gmail dot com
  Target Milestone: ---

Minimized test case (note explicit unsigned long cast):

---
#include <stdlib.h>

int a = 0xecfb39f5;
unsigned short *d = (unsigned short *) &a;

int
main (void)
{
  if ((unsigned long) (65536 * d[1] + d[0]) < (1UL << 28))
    {
      abort ();
    }

  return 0;
}
---

Compiler version:

---
$ ~/x86-toolchain-5.1/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/home/tilir/x86-toolchain-5.1/bin/gcc
COLLECT_LTO_WRAPPER=/home/tilir/x86-toolchain-5.1/libexec/gcc/x86_64-unknown-linux-gnu/5.1.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-5.1-src/gcc_5_1_0_release/configure
--enable-languages=c,c++ --prefix=/home/tilir/x86-toolchain-5.1/
Thread model: posix
gcc version 5.1.0 (GCC)
---

$ ~/x86-toolchain-5.1/bin/gcc -O2 test.c
$ ./a.out
Aborted

but

$ ~/x86-toolchain-5.1/bin/gcc -O2 test.c -fno-tree-vrp
$ ./a.out

Everything is ok.

Before VRP:

  _9 = (unsigned int) _8;
  if (_9 <= 268435455)
    goto <bb 3>;
  else
    goto <bb 4>;


On VRP stage:

_8 : --> single use.
_9 = (unsigned int) _8;

_9 : --> single use.
if (_9 <= 268435455)

After VRP:

  if (_8 <= 268435455)
    goto <bb 3>;
  else
    goto <bb 4>;

By C11 standard, the rank of unsigned long is equal to rank of long and higher,
then rank of int, so integer promotions here should make unsigned long from
both sides.


  parent reply	other threads:[~2015-07-15  9:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-14  7:15 [Bug c/66865] New: wine segfaults from gcc in trunk (r225757) austinenglish at gmail dot com
2015-07-14  7:16 ` [Bug c/66865] wine segfaults from gcc in trunk (r225757) (regression) austinenglish at gmail dot com
2015-07-14  7:22 ` kugan at gcc dot gnu.org
2015-07-14  8:16 ` [Bug rtl-optimization/66865] [6 Regression] " rguenth at gcc dot gnu.org
2015-07-14 22:05 ` marcus at jet dot franken.de
2015-07-14 22:54 ` kugan at gcc dot gnu.org
2015-07-14 22:58 ` [Bug rtl-optimization/66865] [6 Regression] wine64 " austinenglish at gmail dot com
2015-07-14 23:03 ` marcus at jet dot franken.de
2015-07-14 23:05 ` marcus at jet dot franken.de
2015-07-14 23:12 ` marcus at jet dot franken.de
2015-07-14 23:13 ` marcus at jet dot franken.de
2015-07-14 23:13 ` marcus at jet dot franken.de
2015-07-15  6:44 ` marcus at jet dot franken.de
2015-07-15  7:01 ` kugan at gcc dot gnu.org
2015-07-15  9:31 ` ubizjak at gmail dot com [this message]
2015-07-17 22:51 ` austinenglish at gmail dot com

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-66865-4-jxjS37XFl4@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).