public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/16380] New: Use of uninitialised register after dbra conversion
@ 2004-07-06  8:40 rsandifo at gcc dot gnu dot org
  2004-07-06  8:42 ` [Bug rtl-optimization/16380] " rsandifo at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2004-07-06  8:40 UTC (permalink / raw)
  To: gcc-bugs

gcc-3.0 and above miscompile the following test case on mips64-elf
at -O2:

int main ()
{
  int i;
  for (i = 0; i < 10; i++)
    continue;
  if (i < 10)
    abort ();
  exit (0);
}

GCSE realises that the second i < 10 is redundant and reuses
the result of "i < 10" from the for(...) loop.  The loop
optimiser then converts the loop into decrement-and-branch
form and deletes the first comparison.  This leaves the
if (...) statement checking an uninitialised register:

        addiu   $sp,$sp,-40
        sd      $31,32($sp)
        li      $2,9
        addiu   $2,$2,-1
$L10:
        bgez    $2,$L10
        addiu   $2,$2,-1

        beq     $3,$0,$L6      # <---- $3 not initialised
        nop

        jal     abort
        nop

$L6:
        jal     exit
        move    $4,$0

-- 
           Summary: Use of uninitialised register after dbra conversion
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rsandifo at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: mips64-elf


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


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

* [Bug rtl-optimization/16380] Use of uninitialised register after dbra conversion
  2004-07-06  8:40 [Bug rtl-optimization/16380] New: Use of uninitialised register after dbra conversion rsandifo at gcc dot gnu dot org
@ 2004-07-06  8:42 ` rsandifo at gcc dot gnu dot org
  2004-07-06 18:27 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2004-07-06  8:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rsandifo at gcc dot gnu dot org  2004-07-06 08:42 -------
About to submit a patch.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rsandifo at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
      Known to fail|                            |3.0.4 3.2.3 3.3.4 3.4.1
      Known to work|                            |2.95.3


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


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

* [Bug rtl-optimization/16380] Use of uninitialised register after dbra conversion
  2004-07-06  8:40 [Bug rtl-optimization/16380] New: Use of uninitialised register after dbra conversion rsandifo at gcc dot gnu dot org
  2004-07-06  8:42 ` [Bug rtl-optimization/16380] " rsandifo at gcc dot gnu dot org
@ 2004-07-06 18:27 ` cvs-commit at gcc dot gnu dot org
  2004-07-06 20:02 ` [Bug rtl-optimization/16380] [3.3/3.4 Regression] " pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-07-06 18:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-07-06 18:27 -------
Subject: Bug 16380

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rsandifo@gcc.gnu.org	2004-07-06 18:27:35

Modified files:
	gcc            : ChangeLog loop.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.c-torture/execute: 20040706-1.c 

Log message:
	PR rtl-optimization/16380
	* loop.c (check_dbra_loop): Sink comparison instructions if they
	do something other than set cc0.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.4324&r2=2.4325
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/loop.c.diff?cvsroot=gcc&r1=1.501&r2=1.502
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3943&r2=1.3944
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/20040706-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug rtl-optimization/16380] [3.3/3.4 Regression] Use of uninitialised register after dbra conversion
  2004-07-06  8:40 [Bug rtl-optimization/16380] New: Use of uninitialised register after dbra conversion rsandifo at gcc dot gnu dot org
  2004-07-06  8:42 ` [Bug rtl-optimization/16380] " rsandifo at gcc dot gnu dot org
  2004-07-06 18:27 ` cvs-commit at gcc dot gnu dot org
@ 2004-07-06 20:02 ` pinskia at gcc dot gnu dot org
  2004-07-13 15:29 ` cvs-commit at gcc dot gnu dot org
  2004-07-13 15:31 ` rsandifo at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-06 20:02 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|2.95.3                      |2.95.3 3.5.0
            Summary|Use of uninitialised        |[3.3/3.4 Regression] Use of
                   |register after dbra         |uninitialised register after
                   |conversion                  |dbra conversion
   Target Milestone|---                         |3.4.2


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


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

* [Bug rtl-optimization/16380] [3.3/3.4 Regression] Use of uninitialised register after dbra conversion
  2004-07-06  8:40 [Bug rtl-optimization/16380] New: Use of uninitialised register after dbra conversion rsandifo at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-07-06 20:02 ` [Bug rtl-optimization/16380] [3.3/3.4 Regression] " pinskia at gcc dot gnu dot org
@ 2004-07-13 15:29 ` cvs-commit at gcc dot gnu dot org
  2004-07-13 15:31 ` rsandifo at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-07-13 15:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-07-13 15:29 -------
Subject: Bug 16380

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	rsandifo@gcc.gnu.org	2004-07-13 15:29:14

Modified files:
	gcc            : ChangeLog loop.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.c-torture/execute: 20040706-1.c 

Log message:
	PR rtl-optimization/16380
	* loop.c (check_dbra_loop): Sink comparison instructions if they
	do something other than set cc0.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.555&r2=2.2326.2.556
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/loop.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.488.2.4&r2=1.488.2.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.227&r2=1.3389.2.228
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/20040706-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.4.1



-- 


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


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

* [Bug rtl-optimization/16380] [3.3/3.4 Regression] Use of uninitialised register after dbra conversion
  2004-07-06  8:40 [Bug rtl-optimization/16380] New: Use of uninitialised register after dbra conversion rsandifo at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-07-13 15:29 ` cvs-commit at gcc dot gnu dot org
@ 2004-07-13 15:31 ` rsandifo at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2004-07-13 15:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rsandifo at gcc dot gnu dot org  2004-07-13 15:31 -------
Patch applied.

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


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


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

end of thread, other threads:[~2004-07-13 15:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-06  8:40 [Bug rtl-optimization/16380] New: Use of uninitialised register after dbra conversion rsandifo at gcc dot gnu dot org
2004-07-06  8:42 ` [Bug rtl-optimization/16380] " rsandifo at gcc dot gnu dot org
2004-07-06 18:27 ` cvs-commit at gcc dot gnu dot org
2004-07-06 20:02 ` [Bug rtl-optimization/16380] [3.3/3.4 Regression] " pinskia at gcc dot gnu dot org
2004-07-13 15:29 ` cvs-commit at gcc dot gnu dot org
2004-07-13 15:31 ` rsandifo 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).