public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/39002]  New: codegen bug?
@ 2009-01-28 14:18 r dot emrich at de dot tecosim dot com
  2009-01-28 14:21 ` [Bug c++/39002] " r dot emrich at de dot tecosim dot com
                   ` (30 more replies)
  0 siblings, 31 replies; 32+ messages in thread
From: r dot emrich at de dot tecosim dot com @ 2009-01-28 14:18 UTC (permalink / raw)
  To: gcc-bugs

I have a complex C++ application, which used to work at least until gcc-4.4.0
snapshot 20081219, which now segfaults in a strange way.

double distance_2(NODE *P_node1, NODE *P_node2)
{
  return
sqrt(((*P_node1).globalx-(*P_node2).globalx)*((*P_node1).globalx-(*P_node2).globalx)+
             
((*P_node1).globaly-(*P_node2).globaly)*((*P_node1).globaly-(*P_node2).globaly)+
             
((*P_node1).globalz-(*P_node2).globalz)*((*P_node1).globalz-(*P_node2).globalz));
}


void calc_tria_height_2(NODE *n1, NODE *n2, NODE *n11,ostream &out_info,int
&xerror,int &xwarning,double &x,double &y,double &z)
{
  if( distance_2(n1,n2) == 0.0 )
    {
      x = (*n11).globalx;
      y = (*n11).globaly;
      z = (*n11).globalz;
      return;
    }
  if( distance_2(n1,n11) == 0.0 )
    {
      x = (*n11).globalx;
      y = (*n11).globaly;
      z = (*n11).globalz;
      return;
    }
  if( distance_2(n2,n11) == 0.0 )
    {
      x = (*n11).globalx;
      y = (*n11).globaly;
      z = (*n11).globalz;
      return;
    }

  double a1, b1 , c1, la1, la1max;
  double dx, dy, dz, dxyz;
  double dxa1;


  a1 = (*n2).globalx - (*n1).globalx;
  b1 = (*n2).globaly - (*n1).globaly;
  c1 = (*n2).globalz - (*n1).globalz;

  la1max = sqrt (a1 * a1 + b1 * b1 + c1 * c1);

  a1 = a1 / la1max;
  b1 = b1 / la1max;
  c1 = c1 / la1max;

  dx = (*n1).globalx - (*n11).globalx;
  dy = (*n1).globaly - (*n11).globaly;
  dz = (*n1).globalz - (*n11).globalz;

  dxyz = dx * dx + dy * dy + dz * dz;

  dxa1 = 2.0 * dx * a1 + 2.0 * dy * b1 + 2.0 * dz * c1;

  la1 = -dxa1 / 2.0;

  x = (*n1).globalx + (a1 * la1);
  y = (*n1).globaly + (b1 * la1);
  z = (*n1).globalz + (c1 * la1);

  return;
}

compiled with -g0 -O3 it segfaults at the last return.

I will upload the assembler files for gcc snapshot and for trunk.


-- 
           Summary: codegen bug?
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: r dot emrich at de dot tecosim dot com
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-mingw32


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


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

* [Bug c++/39002] codegen bug?
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
@ 2009-01-28 14:21 ` r dot emrich at de dot tecosim dot com
  2009-01-28 14:22 ` r dot emrich at de dot tecosim dot com
                   ` (29 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: r dot emrich at de dot tecosim dot com @ 2009-01-28 14:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from r dot emrich at de dot tecosim dot com  2009-01-28 14:20 -------
Created an attachment (id=17197)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17197&action=view)
assembler source

This one works.


-- 


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


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

* [Bug c++/39002] codegen bug?
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
  2009-01-28 14:21 ` [Bug c++/39002] " r dot emrich at de dot tecosim dot com
@ 2009-01-28 14:22 ` r dot emrich at de dot tecosim dot com
  2009-01-28 14:25 ` falk at debian dot org
                   ` (28 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: r dot emrich at de dot tecosim dot com @ 2009-01-28 14:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from r dot emrich at de dot tecosim dot com  2009-01-28 14:22 -------
Created an attachment (id=17198)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17198&action=view)
assembler source which segfaults

This one segfaults at ret statment at the end.


-- 


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


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

* [Bug c++/39002] codegen bug?
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
  2009-01-28 14:21 ` [Bug c++/39002] " r dot emrich at de dot tecosim dot com
  2009-01-28 14:22 ` r dot emrich at de dot tecosim dot com
@ 2009-01-28 14:25 ` falk at debian dot org
  2009-01-28 14:27 ` r dot emrich at de dot tecosim dot com
                   ` (27 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: falk at debian dot org @ 2009-01-28 14:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from falk at debian dot org  2009-01-28 14:25 -------
We need the preprocessed source of a *complete* (including main) program to be
able to reproduce this.


-- 

falk at debian dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug c++/39002] codegen bug?
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (2 preceding siblings ...)
  2009-01-28 14:25 ` falk at debian dot org
@ 2009-01-28 14:27 ` r dot emrich at de dot tecosim dot com
  2009-01-28 14:44 ` falk at debian dot org
                   ` (26 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: r dot emrich at de dot tecosim dot com @ 2009-01-28 14:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from r dot emrich at de dot tecosim dot com  2009-01-28 14:27 -------
What I can try is finding the revision which causes the fault.


-- 


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


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

* [Bug c++/39002] codegen bug?
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (3 preceding siblings ...)
  2009-01-28 14:27 ` r dot emrich at de dot tecosim dot com
@ 2009-01-28 14:44 ` falk at debian dot org
  2009-01-28 14:45 ` r dot emrich at de dot tecosim dot com
                   ` (25 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: falk at debian dot org @ 2009-01-28 14:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from falk at debian dot org  2009-01-28 14:44 -------
(In reply to comment #4)
> What I can try is finding the revision which causes the fault.

While that would certainly be helpful, it's unlikely that anybody would be
willing to debug this without a usable testcase.


-- 


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


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

* [Bug c++/39002] codegen bug?
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (4 preceding siblings ...)
  2009-01-28 14:44 ` falk at debian dot org
@ 2009-01-28 14:45 ` r dot emrich at de dot tecosim dot com
  2009-01-28 14:57 ` r dot emrich at de dot tecosim dot com
                   ` (24 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: r dot emrich at de dot tecosim dot com @ 2009-01-28 14:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from r dot emrich at de dot tecosim dot com  2009-01-28 14:45 -------
(In reply to comment #3)
> We need the preprocessed source of a *complete* (including main) program to be
> able to reproduce this.
> 

That's a little bit difficult here. It's a really large application.
But what I see from the assembler source is the following.

The spnapshot produces:

.globl __Z18calc_tria_height_2P4NODES0_S0_RSoRiS2_RdS3_S3_
        .def    __Z18calc_tria_height_2P4NODES0_S0_RSoRiS2_RdS3_S3_;    .scl   
2;      .type   32;     .endef
__Z18calc_tria_height_2P4NODES0_S0_RSoRiS2_RdS3_S3_:
        subq    $8, %rsp
        xorpd   %xmm3, %xmm3
.
.
.
L15:
        addq    $8, %rsp
        ret

here the function returns.


trunk produces:

.globl __Z18calc_tria_height_2P4NODES0_S0_RSoRiS2_RdS3_S3_
        .def    __Z18calc_tria_height_2P4NODES0_S0_RSoRiS2_RdS3_S3_;    .scl   
2;      .type   32;     .endef
__Z18calc_tria_height_2P4NODES0_S0_RSoRiS2_RdS3_S3_:
        subq    $88, %rsp
        xorpd   %xmm3, %xmm3
.
.
.
        movsd   %xmm8, (%rax)
        ret

This looks like the stackpointer is no restored.


-- 


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


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

* [Bug c++/39002] codegen bug?
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (5 preceding siblings ...)
  2009-01-28 14:45 ` r dot emrich at de dot tecosim dot com
@ 2009-01-28 14:57 ` r dot emrich at de dot tecosim dot com
  2009-01-28 16:52 ` r dot emrich at de dot tecosim dot com
                   ` (23 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: r dot emrich at de dot tecosim dot com @ 2009-01-28 14:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from r dot emrich at de dot tecosim dot com  2009-01-28 14:57 -------
Anyway I will try to create a self contained small testcase.


-- 


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


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

* [Bug c++/39002] codegen bug?
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (6 preceding siblings ...)
  2009-01-28 14:57 ` r dot emrich at de dot tecosim dot com
@ 2009-01-28 16:52 ` r dot emrich at de dot tecosim dot com
  2009-01-28 17:01 ` r dot emrich at de dot tecosim dot com
                   ` (22 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: r dot emrich at de dot tecosim dot com @ 2009-01-28 16:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from r dot emrich at de dot tecosim dot com  2009-01-28 16:52 -------
Created an attachment (id=17200)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17200&action=view)
self contained testcase

cross compiled to target x86_64-pc-mingw32 segfaults.
commandline: x86_64-pc-mingw32-g++ -Wall -pedantic -g0 -O3 -o segfault
segfault.cpp


-- 


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


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

* [Bug c++/39002] codegen bug?
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (7 preceding siblings ...)
  2009-01-28 16:52 ` r dot emrich at de dot tecosim dot com
@ 2009-01-28 17:01 ` r dot emrich at de dot tecosim dot com
  2009-01-28 17:02 ` r dot emrich at de dot tecosim dot com
                   ` (21 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: r dot emrich at de dot tecosim dot com @ 2009-01-28 17:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from r dot emrich at de dot tecosim dot com  2009-01-28 17:01 -------
Created an attachment (id=17201)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17201&action=view)
preproccesed source


-- 


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


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

* [Bug c++/39002] codegen bug?
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (8 preceding siblings ...)
  2009-01-28 17:01 ` r dot emrich at de dot tecosim dot com
@ 2009-01-28 17:02 ` r dot emrich at de dot tecosim dot com
  2009-01-28 17:06 ` r dot emrich at de dot tecosim dot com
                   ` (20 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: r dot emrich at de dot tecosim dot com @ 2009-01-28 17:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from r dot emrich at de dot tecosim dot com  2009-01-28 17:01 -------
Created an attachment (id=17202)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17202&action=view)
assembler source


-- 


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


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

* [Bug c++/39002] codegen bug?
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (9 preceding siblings ...)
  2009-01-28 17:02 ` r dot emrich at de dot tecosim dot com
@ 2009-01-28 17:06 ` r dot emrich at de dot tecosim dot com
  2009-01-28 18:04 ` r dot emrich at de dot tecosim dot com
                   ` (19 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: r dot emrich at de dot tecosim dot com @ 2009-01-28 17:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from r dot emrich at de dot tecosim dot com  2009-01-28 17:06 -------
I vote for P1 because it's a secondary platform.


-- 


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


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

* [Bug c++/39002] codegen bug?
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (10 preceding siblings ...)
  2009-01-28 17:06 ` r dot emrich at de dot tecosim dot com
@ 2009-01-28 18:04 ` r dot emrich at de dot tecosim dot com
  2009-01-28 19:06 ` r dot emrich at de dot tecosim dot com
                   ` (18 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: r dot emrich at de dot tecosim dot com @ 2009-01-28 18:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from r dot emrich at de dot tecosim dot com  2009-01-28 18:04 -------
fault came up between 2nd and 9th of January.
With visual c++ 2005 there is no problem.


-- 


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


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

* [Bug c++/39002] codegen bug?
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (11 preceding siblings ...)
  2009-01-28 18:04 ` r dot emrich at de dot tecosim dot com
@ 2009-01-28 19:06 ` r dot emrich at de dot tecosim dot com
  2009-01-29  8:05 ` [Bug target/39002] codegen bug, stack pointer is not restored ubizjak at gmail dot com
                   ` (17 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: r dot emrich at de dot tecosim dot com @ 2009-01-28 19:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from r dot emrich at de dot tecosim dot com  2009-01-28 19:06 -------
The changes in revision 143118 to revesion 143120 are causing the fault.


-- 


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


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

* [Bug target/39002] codegen bug, stack pointer is not restored
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (12 preceding siblings ...)
  2009-01-28 19:06 ` r dot emrich at de dot tecosim dot com
@ 2009-01-29  8:05 ` ubizjak at gmail dot com
  2009-01-29  8:06 ` [Bug target/39002] [4,4 Regression] " ubizjak at gmail dot com
                   ` (16 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: ubizjak at gmail dot com @ 2009-01-29  8:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from ubizjak at gmail dot com  2009-01-29 08:05 -------
Cc the author of the patch:

Author: hubicka
Date: Tue Jan  6 15:08:44 2009
New Revision: 143119

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143119
Log:

        * i386.h (CONDITIONAL_CALL_USAGE): SSE regs are not used for w64 ABI.
        * i386.c (struct ix86_frame): Add padding0 and nsseregs.
        (ix86_nsaved_regs): Count only general purpose regs.
        (ix86_nsaved_sseregs): New.
        (ix86_compute_frame_layout): Update nsseregs; set preferred alignment
        to 16 for w64; compute padding and size of sse reg save area.
        (ix86_emit_save_regs, ix86_emit_save_regs_using_mov): Save only general
        purpose regs.
        (ix86_emit_save_sse_regs_using_mov): New.
        (ix86_expand_prologue): Save SSE regs if needed.
        (ix86_emit_restore_regs_using_mov): Use only general purpose regs.
        (ix86_emit_restore_sse_regs_using_mov): New.
        (ix86_expand_epilogue): Save SSE regs if needed.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c
    trunk/gcc/config/i386/i386.h


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu dot
                   |                            |org
             Status|WAITING                     |NEW
          Component|c++                         |target
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-01-29 08:05:29
               date|                            |
            Summary|codegen bug?                |codegen bug, stack pointer
                   |                            |is not restored


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


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

* [Bug target/39002] [4,4 Regression] codegen bug, stack pointer is not restored
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (13 preceding siblings ...)
  2009-01-29  8:05 ` [Bug target/39002] codegen bug, stack pointer is not restored ubizjak at gmail dot com
@ 2009-01-29  8:06 ` ubizjak at gmail dot com
  2009-01-29 10:31 ` [Bug target/39002] [4.4 " jakub at gcc dot gnu dot org
                   ` (15 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: ubizjak at gmail dot com @ 2009-01-29  8:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from ubizjak at gmail dot com  2009-01-29 08:06 -------
4.4 regression.


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|codegen bug, stack pointer  |[4,4 Regression] codegen
                   |is not restored             |bug, stack pointer is not
                   |                            |restored
   Target Milestone|---                         |4.4.0


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


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

* [Bug target/39002] [4.4 Regression] codegen bug, stack pointer is not restored
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (14 preceding siblings ...)
  2009-01-29  8:06 ` [Bug target/39002] [4,4 Regression] " ubizjak at gmail dot com
@ 2009-01-29 10:31 ` jakub at gcc dot gnu dot org
  2009-01-29 10:47 ` r dot emrich at de dot tecosim dot com
                   ` (14 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-01-29 10:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from jakub at gcc dot gnu dot org  2009-01-29 10:31 -------
Created an attachment (id=17208)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17208&action=view)
gcc44-pr39002.patch

As MS_ABI sseregs save area isn't counted into frame.allocate anymore, IMHO
ix86_can_use_return_insn_p has to check for that too.  This patch cures the
testcase for visual inspection.  Could somebody please bootstrap/regtest it on
mingw?  I can bootstrap/regtest it on x86_64-linux, but as nsseregs is always
zero there, this won't be sufficient test.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug target/39002] [4.4 Regression] codegen bug, stack pointer is not restored
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (15 preceding siblings ...)
  2009-01-29 10:31 ` [Bug target/39002] [4.4 " jakub at gcc dot gnu dot org
@ 2009-01-29 10:47 ` r dot emrich at de dot tecosim dot com
  2009-01-29 11:35 ` r dot emrich at de dot tecosim dot com
                   ` (13 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: r dot emrich at de dot tecosim dot com @ 2009-01-29 10:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from r dot emrich at de dot tecosim dot com  2009-01-29 10:47 -------
(In reply to comment #16)
> Created an attachment (id=17208)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17208&action=view) [edit]
> gcc44-pr39002.patch
> 
> As MS_ABI sseregs save area isn't counted into frame.allocate anymore, IMHO
> ix86_can_use_return_insn_p has to check for that too.  This patch cures the
> testcase for visual inspection.  Could somebody please bootstrap/regtest it on
> mingw?  I can bootstrap/regtest it on x86_64-linux, but as nsseregs is always
> zero there, this won't be sufficient test.
> 

I can will do my cross build and test in the afternoon.


-- 


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


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

* [Bug target/39002] [4.4 Regression] codegen bug, stack pointer is not restored
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (16 preceding siblings ...)
  2009-01-29 10:47 ` r dot emrich at de dot tecosim dot com
@ 2009-01-29 11:35 ` r dot emrich at de dot tecosim dot com
  2009-01-29 12:04 ` jakub at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: r dot emrich at de dot tecosim dot com @ 2009-01-29 11:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #18 from r dot emrich at de dot tecosim dot com  2009-01-29 11:34 -------
(In reply to comment #17)
> (In reply to comment #16)
> > Created an attachment (id=17208)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17208&action=view) [edit]
> > gcc44-pr39002.patch
> > 
> > As MS_ABI sseregs save area isn't counted into frame.allocate anymore, IMHO
> > ix86_can_use_return_insn_p has to check for that too.  This patch cures the
> > testcase for visual inspection.  Could somebody please bootstrap/regtest it on
> > mingw?  I can bootstrap/regtest it on x86_64-linux, but as nsseregs is always
> > zero there, this won't be sufficient test.
> > 
> 
> I can will do my cross build and test in the afternoon.
> 

Solves my problem. But I can't run the testsuite, because I don't have a
sufficient setup.


-- 


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


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

* [Bug target/39002] [4.4 Regression] codegen bug, stack pointer is not restored
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (17 preceding siblings ...)
  2009-01-29 11:35 ` r dot emrich at de dot tecosim dot com
@ 2009-01-29 12:04 ` jakub at gcc dot gnu dot org
  2009-01-29 12:21 ` ktietz at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-01-29 12:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #19 from jakub at gcc dot gnu dot org  2009-01-29 12:03 -------
Anyone else could test it, please?


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ktietz at gcc dot gnu dot
                   |                            |org, dannysmith at gcc dot
                   |                            |gnu dot org


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


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

* [Bug target/39002] [4.4 Regression] codegen bug, stack pointer is not restored
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (18 preceding siblings ...)
  2009-01-29 12:04 ` jakub at gcc dot gnu dot org
@ 2009-01-29 12:21 ` ktietz at gcc dot gnu dot org
  2009-01-29 12:27 ` ktietz at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: ktietz at gcc dot gnu dot org @ 2009-01-29 12:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #20 from ktietz at gcc dot gnu dot org  2009-01-29 12:21 -------
(In reply to comment #19)
> Anyone else could test it, please?

I am currently on to test it for w64. We noticed a regression reasoned by this
for this target, too (sadly we found it pretty late).

This patch seems fine, but I guess that in ix86_expand_epilogue also the checks
for frame.nregs should be altered to (frame.nregs + frame.nsseregs), too.


-- 


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


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

* [Bug target/39002] [4.4 Regression] codegen bug, stack pointer is not restored
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (19 preceding siblings ...)
  2009-01-29 12:21 ` ktietz at gcc dot gnu dot org
@ 2009-01-29 12:27 ` ktietz at gcc dot gnu dot org
  2009-01-29 12:53 ` ktietz at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: ktietz at gcc dot gnu dot org @ 2009-01-29 12:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #21 from ktietz at gcc dot gnu dot org  2009-01-29 12:27 -------
Created an attachment (id=17210)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17210&action=view)
Alternative patch suggested

This is the patch I test at the moment.


-- 


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


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

* [Bug target/39002] [4.4 Regression] codegen bug, stack pointer is not restored
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (20 preceding siblings ...)
  2009-01-29 12:27 ` ktietz at gcc dot gnu dot org
@ 2009-01-29 12:53 ` ktietz at gcc dot gnu dot org
  2009-01-29 13:24 ` jakub at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: ktietz at gcc dot gnu dot org @ 2009-01-29 12:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #22 from ktietz at gcc dot gnu dot org  2009-01-29 12:52 -------
(In reply to comment #21)
> Created an attachment (id=17210)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17210&action=view) [edit]
> Alternative patch suggested
> This is the patch I test at the moment.

The patch I posted works for w64 without any regressions. For linux64 it needs
to be tested, too. I have here at work no linux64 box.


-- 


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


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

* [Bug target/39002] [4.4 Regression] codegen bug, stack pointer is not restored
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (21 preceding siblings ...)
  2009-01-29 12:53 ` ktietz at gcc dot gnu dot org
@ 2009-01-29 13:24 ` jakub at gcc dot gnu dot org
  2009-01-29 13:46 ` ktietz at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-01-29 13:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #23 from jakub at gcc dot gnu dot org  2009-01-29 13:23 -------
I don't see why ix86_expand_epilogue should be changed.  Do you have some
testcase which shows where your change improves generated code?

I can certainly test on Linux, but as frame.nsseregs is always 0 there, it
should make zilch difference.


-- 


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


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

* [Bug target/39002] [4.4 Regression] codegen bug, stack pointer is not restored
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (22 preceding siblings ...)
  2009-01-29 13:24 ` jakub at gcc dot gnu dot org
@ 2009-01-29 13:46 ` ktietz at gcc dot gnu dot org
  2009-01-29 13:54 ` jakub at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: ktietz at gcc dot gnu dot org @ 2009-01-29 13:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #24 from ktietz at gcc dot gnu dot org  2009-01-29 13:45 -------
(In reply to comment #23)
> I don't see why ix86_expand_epilogue should be changed.  Do you have some
> testcase which shows where your change improves generated code?
> I can certainly test on Linux, but as frame.nsseregs is always 0 there, it
> should make zilch difference.

It is the same testcase for w64. Just the option -fno-omit-frame-pointer has to
be added. This leads on w64 to an ICE (internal abort) without this patch.


-- 


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


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

* [Bug target/39002] [4.4 Regression] codegen bug, stack pointer is not restored
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (23 preceding siblings ...)
  2009-01-29 13:46 ` ktietz at gcc dot gnu dot org
@ 2009-01-29 13:54 ` jakub at gcc dot gnu dot org
  2009-01-29 14:05 ` ktietz at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-01-29 13:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #25 from jakub at gcc dot gnu dot org  2009-01-29 13:54 -------
Can't reproduce that with a cross compiler.


-- 


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


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

* [Bug target/39002] [4.4 Regression] codegen bug, stack pointer is not restored
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (24 preceding siblings ...)
  2009-01-29 13:54 ` jakub at gcc dot gnu dot org
@ 2009-01-29 14:05 ` ktietz at gcc dot gnu dot org
  2009-01-29 14:34 ` jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: ktietz at gcc dot gnu dot org @ 2009-01-29 14:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #26 from ktietz at gcc dot gnu dot org  2009-01-29 14:04 -------
(In reply to comment #25)
> Can't reproduce that with a cross compiler.

You are right, I changed something else, too. Sorry.

But this patch to expand_epilogue is proper IIUC

Comment tells
"If we're only restoring one register and sp is not valid then using a move
instruction to restore the register since it's less work than reloading sp and
popping the register." ...
for w64 the can be more then one register in use but the check in the if
doesn't verify this, and produces therefore slower code.


-- 


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


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

* [Bug target/39002] [4.4 Regression] codegen bug, stack pointer is not restored
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (25 preceding siblings ...)
  2009-01-29 14:05 ` ktietz at gcc dot gnu dot org
@ 2009-01-29 14:34 ` jakub at gcc dot gnu dot org
  2009-01-29 22:48 ` sezeroz at gmail dot com
                   ` (3 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-01-29 14:34 UTC (permalink / raw)
  To: gcc-bugs



-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


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


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

* [Bug target/39002] [4.4 Regression] codegen bug, stack pointer is not restored
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (26 preceding siblings ...)
  2009-01-29 14:34 ` jakub at gcc dot gnu dot org
@ 2009-01-29 22:48 ` sezeroz at gmail dot com
  2009-01-30  8:54 ` ktietz at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  30 siblings, 0 replies; 32+ messages in thread
From: sezeroz at gmail dot com @ 2009-01-29 22:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #27 from sezeroz at gmail dot com  2009-01-29 22:48 -------
I can confirm that after applying pr_w64.diff of Kai Tietz to svn rev 143768,
my similar problem which I reported at mingw-w64 site (which is also related
to the 143119 commit) is fixed.  Thanks to all who wonked on this.


-- 

sezeroz at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sezeroz at gmail dot com


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


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

* [Bug target/39002] [4.4 Regression] codegen bug, stack pointer is not restored
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (27 preceding siblings ...)
  2009-01-29 22:48 ` sezeroz at gmail dot com
@ 2009-01-30  8:54 ` ktietz at gcc dot gnu dot org
  2009-01-30  9:23 ` jakub at gcc dot gnu dot org
  2009-01-30  9:29 ` jakub at gcc dot gnu dot org
  30 siblings, 0 replies; 32+ messages in thread
From: ktietz at gcc dot gnu dot org @ 2009-01-30  8:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #28 from ktietz at gcc dot gnu dot org  2009-01-30 08:54 -------
(In reply to comment #19)
> Anyone else could test it, please?

ok, I tested it for linux64 and and for w64 without any new problems.
I applied the patch (see rev. #143780). Just the testcase is missing.
Do you apply it and set then the bug as fixed?


-- 


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


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

* [Bug target/39002] [4.4 Regression] codegen bug, stack pointer is not restored
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (28 preceding siblings ...)
  2009-01-30  8:54 ` ktietz at gcc dot gnu dot org
@ 2009-01-30  9:23 ` jakub at gcc dot gnu dot org
  2009-01-30  9:29 ` jakub at gcc dot gnu dot org
  30 siblings, 0 replies; 32+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-01-30  9:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #29 from jakub at gcc dot gnu dot org  2009-01-30 09:23 -------
Subject: Bug 39002

Author: jakub
Date: Fri Jan 30 09:22:48 2009
New Revision: 143782

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143782
Log:
        PR target/39002
        * g++.dg/torture/pr39002.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/torture/pr39002.C
Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug target/39002] [4.4 Regression] codegen bug, stack pointer is not restored
  2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
                   ` (29 preceding siblings ...)
  2009-01-30  9:23 ` jakub at gcc dot gnu dot org
@ 2009-01-30  9:29 ` jakub at gcc dot gnu dot org
  30 siblings, 0 replies; 32+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-01-30  9:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #30 from jakub at gcc dot gnu dot org  2009-01-30 09:29 -------
Fixed.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2009-01-30  9:29 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
2009-01-28 14:21 ` [Bug c++/39002] " r dot emrich at de dot tecosim dot com
2009-01-28 14:22 ` r dot emrich at de dot tecosim dot com
2009-01-28 14:25 ` falk at debian dot org
2009-01-28 14:27 ` r dot emrich at de dot tecosim dot com
2009-01-28 14:44 ` falk at debian dot org
2009-01-28 14:45 ` r dot emrich at de dot tecosim dot com
2009-01-28 14:57 ` r dot emrich at de dot tecosim dot com
2009-01-28 16:52 ` r dot emrich at de dot tecosim dot com
2009-01-28 17:01 ` r dot emrich at de dot tecosim dot com
2009-01-28 17:02 ` r dot emrich at de dot tecosim dot com
2009-01-28 17:06 ` r dot emrich at de dot tecosim dot com
2009-01-28 18:04 ` r dot emrich at de dot tecosim dot com
2009-01-28 19:06 ` r dot emrich at de dot tecosim dot com
2009-01-29  8:05 ` [Bug target/39002] codegen bug, stack pointer is not restored ubizjak at gmail dot com
2009-01-29  8:06 ` [Bug target/39002] [4,4 Regression] " ubizjak at gmail dot com
2009-01-29 10:31 ` [Bug target/39002] [4.4 " jakub at gcc dot gnu dot org
2009-01-29 10:47 ` r dot emrich at de dot tecosim dot com
2009-01-29 11:35 ` r dot emrich at de dot tecosim dot com
2009-01-29 12:04 ` jakub at gcc dot gnu dot org
2009-01-29 12:21 ` ktietz at gcc dot gnu dot org
2009-01-29 12:27 ` ktietz at gcc dot gnu dot org
2009-01-29 12:53 ` ktietz at gcc dot gnu dot org
2009-01-29 13:24 ` jakub at gcc dot gnu dot org
2009-01-29 13:46 ` ktietz at gcc dot gnu dot org
2009-01-29 13:54 ` jakub at gcc dot gnu dot org
2009-01-29 14:05 ` ktietz at gcc dot gnu dot org
2009-01-29 14:34 ` jakub at gcc dot gnu dot org
2009-01-29 22:48 ` sezeroz at gmail dot com
2009-01-30  8:54 ` ktietz at gcc dot gnu dot org
2009-01-30  9:23 ` jakub at gcc dot gnu dot org
2009-01-30  9:29 ` jakub 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).