public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/15387] New: Misscompilation in sibcall optimization
@ 2004-05-12 19:01 rakdver at gcc dot gnu dot org
  2004-05-12 19:14 ` [Bug middle-end/15387] [tree-ssa] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: rakdver at gcc dot gnu dot org @ 2004-05-12 19:01 UTC (permalink / raw)
  To: gcc-bugs

The following testcase aborts when compiled with -O2:

struct foo { int a, b, c; };

void
brother (int a, int b)
{
  if (a)
    abort ();
}


void
sister (struct foo f, int b)
{
  int *tmp = &f.b;

  brother (*tmp == b, b);
}

int
main (void)
{
  struct foo f;

  f.a = 7;
  f.b = 8;
  f.c = 9;
  sister (f, 1);
  exit (0);
}

The problem is that a sibcall is created for a call of brother, but the
arguments are rewritten in place.  Therefore first the place on the stack
where f.b is stored is rewritten by b, and then it is compared to b.

Probably caused by some interaction between the new way how the tail calls are
handled (information passed from tree level) and calls.c.

-- 
           Summary: Misscompilation in sibcall optimization
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rakdver at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org,jh at suse dot cz
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug middle-end/15387] [tree-ssa] Misscompilation in sibcall optimization
  2004-05-12 19:01 [Bug optimization/15387] New: Misscompilation in sibcall optimization rakdver at gcc dot gnu dot org
@ 2004-05-12 19:14 ` pinskia at gcc dot gnu dot org
  2004-05-22 21:04 ` [Bug rtl-optimization/15387] [3.5 Regression] " rakdver at gcc dot gnu dot org
  2004-07-11  2:53 ` rakdver at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-12 19:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-11 21:46 -------
Confirmed, the issue is that it is putting the variable b in the slot too early so it is comparing against 
itself which gets optimized in later passes to 1.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|optimization                |middle-end
     Ever Confirmed|                            |1
           Keywords|                            |RTL
   Last reconfirmed|0000-00-00 00:00:00         |2004-05-11 21:46:15
               date|                            |
            Summary|Misscompilation in sibcall  |[tree-ssa] Misscompilation
                   |optimization                |in sibcall optimization
   Target Milestone|---                         |tree-ssa


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


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

* [Bug rtl-optimization/15387] [3.5 Regression] Misscompilation in sibcall optimization
  2004-05-12 19:01 [Bug optimization/15387] New: Misscompilation in sibcall optimization rakdver at gcc dot gnu dot org
  2004-05-12 19:14 ` [Bug middle-end/15387] [tree-ssa] " pinskia at gcc dot gnu dot org
@ 2004-05-22 21:04 ` rakdver at gcc dot gnu dot org
  2004-07-11  2:53 ` rakdver at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: rakdver at gcc dot gnu dot org @ 2004-05-22 21:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rakdver at gcc dot gnu dot org  2004-05-21 21:38 -------
Analysis and possible patch:

http://gcc.gnu.org/ml/gcc-patches/2004-05/msg01396.html

-- 


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


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

* [Bug rtl-optimization/15387] [3.5 Regression] Misscompilation in sibcall optimization
  2004-05-12 19:01 [Bug optimization/15387] New: Misscompilation in sibcall optimization rakdver at gcc dot gnu dot org
  2004-05-12 19:14 ` [Bug middle-end/15387] [tree-ssa] " pinskia at gcc dot gnu dot org
  2004-05-22 21:04 ` [Bug rtl-optimization/15387] [3.5 Regression] " rakdver at gcc dot gnu dot org
@ 2004-07-11  2:53 ` rakdver at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: rakdver at gcc dot gnu dot org @ 2004-07-11  2:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rakdver at gcc dot gnu dot org  2004-07-11 02:53 -------
Fixed.

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


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


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

end of thread, other threads:[~2004-07-11  2:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-12 19:01 [Bug optimization/15387] New: Misscompilation in sibcall optimization rakdver at gcc dot gnu dot org
2004-05-12 19:14 ` [Bug middle-end/15387] [tree-ssa] " pinskia at gcc dot gnu dot org
2004-05-22 21:04 ` [Bug rtl-optimization/15387] [3.5 Regression] " rakdver at gcc dot gnu dot org
2004-07-11  2:53 ` rakdver 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).