public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/13832] New: [tree-ssa] dom-pass produces wrong code
@ 2004-01-23 15:40 spop at gcc dot gnu dot org
  2004-01-23 16:51 ` [Bug optimization/13832] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: spop at gcc dot gnu dot org @ 2004-01-23 15:40 UTC (permalink / raw)
  To: gcc-bugs

Hi,

As described in 
  http://gcc.gnu.org/ml/gcc-patches/2004-01/msg02440.html
the following testcase produces wrong code when compiled with tree-ssa:

int main(void)
{
  int a = 0;
  int b;
  while (a < 50)
    {           
      for (b = 0; b < 10; b++)
        {
          a++;
        }
      a++;
    }
}

Attached the assembler output of "-O2 -S" on i686-pc-linux-gnu
for the branch tree-ssa-lno and for gcc-3.3.2:

	.file	"foo.c"
	.text
	.p2align 2,,3
.globl main
	.type	main, @function
main:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$8, %esp
	andl	$-16, %esp
	subl	$16, %esp
	xorl	%ecx, %ecx
.L2:
	xorl	%eax, %eax
	jmp	.L3
	.p2align 2,,3
.L8:
	movl	%edx, %ecx
.L3:
	incl	%eax
	cmpl	$9, %eax
	leal	1(%ecx), %edx
	jle	.L8
	addl	$2, %ecx
	cmpl	$49, %ecx
	jle	.L2
	leave
	ret
	.size	main, .-main
	.section	.note.GNU-stack,"",@progbits
	.ident	"GCC: (GNU) 3.5-tree-ssa-lno 20040121 (merged 20040120)"



	.file	"foo.c"
	.text
.globl main
	.type	main, @function
main:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$8, %esp
	andl	$-16, %esp
	movl	$0, %eax
	subl	%eax, %esp
	movl	$0, -4(%ebp)
.L2:
	cmpl	$49, -4(%ebp)
	jle	.L4
	jmp	.L3
.L4:
	movl	$0, -8(%ebp)
.L5:
	cmpl	$9, -8(%ebp)
	jle	.L8
	jmp	.L6
.L8:
	leal	-4(%ebp), %eax
	incl	(%eax)
	leal	-8(%ebp), %eax
	incl	(%eax)
	jmp	.L5
.L6:
	leal	-4(%ebp), %eax
	incl	(%eax)
	jmp	.L2
.L3:
	leave
	ret
	.size	main, .-main
	.section	.note.GNU-stack,"",@progbits
	.ident	"GCC: (GNU) 3.3.2 (Debian)"

-- 
           Summary: [tree-ssa] dom-pass produces wrong code
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: spop at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org,law at redhat dot
                    com,pop at gauvain dot u-strasbg dot fr


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


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

* [Bug optimization/13832] [tree-ssa] dom-pass produces wrong code
  2004-01-23 15:40 [Bug middle-end/13832] New: [tree-ssa] dom-pass produces wrong code spop at gcc dot gnu dot org
@ 2004-01-23 16:51 ` pinskia at gcc dot gnu dot org
  2004-01-24  3:27 ` pinskia at gcc dot gnu dot org
  2004-01-27 12:46 ` spop at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-23 16:51 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical
          Component|middle-end                  |optimization
           Keywords|                            |wrong-code
   Target Milestone|---                         |tree-ssa


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


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

* [Bug optimization/13832] [tree-ssa] dom-pass produces wrong code
  2004-01-23 15:40 [Bug middle-end/13832] New: [tree-ssa] dom-pass produces wrong code spop at gcc dot gnu dot org
  2004-01-23 16:51 ` [Bug optimization/13832] " pinskia at gcc dot gnu dot org
@ 2004-01-24  3:27 ` pinskia at gcc dot gnu dot org
  2004-01-27 12:46 ` spop at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-24  3:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-24 03:27 -------
Confirmed.  This is caused by jump-threading I think which does not update the PHI to be 
right.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-01-24 03:27:44
               date|                            |


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


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

* [Bug optimization/13832] [tree-ssa] dom-pass produces wrong code
  2004-01-23 15:40 [Bug middle-end/13832] New: [tree-ssa] dom-pass produces wrong code spop at gcc dot gnu dot org
  2004-01-23 16:51 ` [Bug optimization/13832] " pinskia at gcc dot gnu dot org
  2004-01-24  3:27 ` pinskia at gcc dot gnu dot org
@ 2004-01-27 12:46 ` spop at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: spop at gcc dot gnu dot org @ 2004-01-27 12:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From spop at gcc dot gnu dot org  2004-01-27 12:46 -------
dom pass enables the copy propagation of the increment of the last iteration 
of the inner loop into the increment of the outer loop.  



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


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


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

end of thread, other threads:[~2004-01-27 12:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-23 15:40 [Bug middle-end/13832] New: [tree-ssa] dom-pass produces wrong code spop at gcc dot gnu dot org
2004-01-23 16:51 ` [Bug optimization/13832] " pinskia at gcc dot gnu dot org
2004-01-24  3:27 ` pinskia at gcc dot gnu dot org
2004-01-27 12:46 ` spop 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).