public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/50633] [4.7 Regression] New test failures
Date: Thu, 06 Oct 2011 17:56:00 -0000	[thread overview]
Message-ID: <bug-50633-4-km8q2pWzZD@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-50633-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> 2011-10-06 17:55:48 UTC ---
Here is a small testcase. shrink-wrap screwed up stack adjustment
for local variables:

[hjl@gnu-mic-2 pr50633]$ cat x.i
struct s { int val[16]; };

extern double f (struct s pb, double pc);

int main ()
{
  struct s x;
  int i;

  for (i = 0; i < 16; i++)
    x.val[i] = i + 1;
  if (f (x, 10000.0L) != 10136.0L)
    __builtin_abort ();
  return 0;
}
[hjl@gnu-mic-2 pr50633]$ /export/build/gnu/gcc-x32/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/ -mx32 -O -S x.i
-fno-shrink-wrap -o good.s
[hjl@gnu-mic-2 pr50633]$ /export/build/gnu/gcc-x32/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/ -mx32 -O -S x.i -o bad.s
[hjl@gnu-mic-2 pr50633]$ cat good.s
    .file    "x.i"
    .text
    .globl    main
    .type    main, @function
main:
.LFB0:
    .cfi_startproc
    subq    $136, %rsp
    .cfi_def_cfa_offset 144
    movl    $0, %eax
    movl    %esp, %ecx
    addl    $60, %ecx
.L2:
    addl    $1, %eax
    leal    (%rcx,%rax,4), %edx
    movl    %eax, (%edx)
    cmpl    $16, %eax
    jne    .L2
    movq    64(%rsp), %rax
    movq    %rax, (%rsp)
    movq    72(%rsp), %rax
    movq    %rax, 8(%rsp)
    movq    80(%rsp), %rax
    movq    %rax, 16(%rsp)
    movq    88(%rsp), %rax
    movq    %rax, 24(%rsp)
    movq    96(%rsp), %rax
    movq    %rax, 32(%rsp)
    movq    104(%rsp), %rax
    movq    %rax, 40(%rsp)
    movq    112(%rsp), %rax
    movq    %rax, 48(%rsp)
    movq    120(%rsp), %rax
    movq    %rax, 56(%rsp)
    movsd    .LC0(%rip), %xmm0
    call    f
    ucomisd    .LC1(%rip), %xmm0
    jp    .L5
    je    .L7
.L5:
    call    abort
.L7:
    movl    $0, %eax
    addq    $136, %rsp
    .cfi_def_cfa_offset 8
    ret
    .cfi_endproc
.LFE0:
    .size    main, .-main
    .section    .rodata.cst8,"aM",@progbits,8
    .align 8
.LC0:
    .long    0
    .long    1086556160
    .align 8
.LC1:
    .long    0
    .long    1086573568
    .ident    "GCC: (GNU) 4.7.0 20111005 (experimental)"
    .section    .note.GNU-stack,"",@progbits
[hjl@gnu-mic-2 pr50633]$ cat bad.s
    .file    "x.i"
    .text
    .globl    main
    .type    main, @function
main:
.LFB0:
    .cfi_startproc
    movl    $0, %eax
    movl    %esp, %ecx
    addl    $60, %ecx
.L2:
    addl    $1, %eax
    leal    (%rcx,%rax,4), %edx
    movl    %eax, (%edx)
    cmpl    $16, %eax
    jne    .L2
    subq    $136, %rsp
    .cfi_def_cfa_offset 144
    movq    64(%rsp), %rax
    movq    %rax, (%rsp)
    movq    72(%rsp), %rax
    movq    %rax, 8(%rsp)
    movq    80(%rsp), %rax
    movq    %rax, 16(%rsp)
    movq    88(%rsp), %rax
    movq    %rax, 24(%rsp)
    movq    96(%rsp), %rax
    movq    %rax, 32(%rsp)
    movq    104(%rsp), %rax
    movq    %rax, 40(%rsp)
    movq    112(%rsp), %rax
    movq    %rax, 48(%rsp)
    movq    120(%rsp), %rax
    movq    %rax, 56(%rsp)
    movsd    .LC0(%rip), %xmm0
    call    f
    ucomisd    .LC1(%rip), %xmm0
    jp    .L5
    je    .L7
.L5:
    call    abort
.L7:
    movl    $0, %eax
    addq    $136, %rsp
    .cfi_def_cfa_offset 8
    ret
    .cfi_endproc
.LFE0:
    .size    main, .-main
    .section    .rodata.cst8,"aM",@progbits,8
    .align 8
.LC0:
    .long    0
    .long    1086556160
    .align 8
.LC1:
    .long    0
    .long    1086573568
    .ident    "GCC: (GNU) 4.7.0 20111005 (experimental)"
    .section    .note.GNU-stack,"",@progbits
[hjl@gnu-mic-2 pr50633]$ diff -up good.s bad.s
--- good.s    2011-10-06 10:52:45.410961190 -0700
+++ bad.s    2011-10-06 10:52:48.938896097 -0700
@@ -5,8 +5,6 @@
 main:
 .LFB0:
     .cfi_startproc
-    subq    $136, %rsp
-    .cfi_def_cfa_offset 144
     movl    $0, %eax
     movl    %esp, %ecx
     addl    $60, %ecx
@@ -16,6 +14,8 @@ main:
     movl    %eax, (%edx)
     cmpl    $16, %eax
     jne    .L2
+    subq    $136, %rsp
+    .cfi_def_cfa_offset 144
     movq    64(%rsp), %rax
     movq    %rax, (%rsp)
     movq    72(%rsp), %rax
[hjl@gnu-mic-2 pr50633]$


  parent reply	other threads:[~2011-10-06 17:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-06 16:01 [Bug middle-end/50633] New: " hjl.tools at gmail dot com
2011-10-06 16:06 ` [Bug middle-end/50633] " ro at gcc dot gnu.org
2011-10-06 16:24 ` dominiq at lps dot ens.fr
2011-10-06 17:40 ` hjl.tools at gmail dot com
2011-10-06 17:56 ` hjl.tools at gmail dot com [this message]
2011-10-06 18:39 ` hjl.tools at gmail dot com
2011-10-06 18:44 ` bernds at gcc dot gnu.org
2011-10-06 18:51 ` hjl.tools at gmail dot com
2011-10-06 18:52 ` hjl.tools at gmail dot com
2011-10-06 19:59 ` bernds at gcc dot gnu.org
2011-10-06 20:09 ` hjl.tools at gmail dot com
2011-10-07 12:10 ` bernds at gcc dot gnu.org
2011-10-07 12:21 ` bernds at gcc dot gnu.org
2011-10-07 16:21 ` hjl.tools 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-50633-4-km8q2pWzZD@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).