public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/29877]  New: Tree optimization extends variable life of variable beyond original declared
@ 2006-11-17 17:58 diego dot dompe at ridgerun dot com
  2006-11-17 18:31 ` [Bug tree-optimization/29877] out of SSA (TER) " pinskia at gcc dot gnu dot org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: diego dot dompe at ridgerun dot com @ 2006-11-17 17:58 UTC (permalink / raw)
  To: gcc-bugs

There is a bug on the tree optimization code generated by gcc that produces
corruption of variables on some corner cases of code generated by Linux kernel
for ARM. I originally found the bug on codesourcery releases but was able to
reproduced it on gcc 4.1 that I builded.

Detailed explanation and some insights from codesourcery guys can be found at
this mail thread:

http://www.codesourcery.com/archives/arm-gnu/msg00961.html

The example code that triggers the bug is found there too.


-- 
           Summary: Tree optimization extends variable life of variable
                    beyond original declared
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: diego dot dompe at ridgerun dot com
 GCC build triplet: x86_64-pc-linux-gnu
  GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: arm-linux-uclibcgnueabi


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


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

* [Bug tree-optimization/29877] out of SSA (TER) extends variable life of variable beyond original declared
  2006-11-17 17:58 [Bug tree-optimization/29877] New: Tree optimization extends variable life of variable beyond original declared diego dot dompe at ridgerun dot com
@ 2006-11-17 18:31 ` pinskia at gcc dot gnu dot org
  2006-11-17 19:28 ` amacleod at redhat dot com
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-17 18:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-11-17 18:31 -------
TER causes this ...


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|out of SSA extends variable |out of SSA (TER) extends
                   |life of variable beyond     |variable life of variable
                   |original declared           |beyond original declared


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


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

* [Bug tree-optimization/29877] out of SSA (TER) extends variable life of variable beyond original declared
  2006-11-17 17:58 [Bug tree-optimization/29877] New: Tree optimization extends variable life of variable beyond original declared diego dot dompe at ridgerun dot com
  2006-11-17 18:31 ` [Bug tree-optimization/29877] out of SSA (TER) " pinskia at gcc dot gnu dot org
@ 2006-11-17 19:28 ` amacleod at redhat dot com
  2006-11-18  4:58 ` shinwell at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: amacleod at redhat dot com @ 2006-11-17 19:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from amacleod at redhat dot com  2006-11-17 19:28 -------
A .i file would have been handy. IN any case thats easily worked around.

The issue here isn't that the lifetoime of something is being extended since
the tree optimizers already made __res function scope.  The problem is that it
is defined to be a specific register:

register long long unsigned int __res __asm__ (*r2);

and when its copied to 
t_10 = __res

that is OK as well.  t_10 is then used a single time a few stmts away, and this
triggers TER to substitute __res at t_10's use location.

The simplest and obvious fix I think would be to disable expansion of an
expression if the base variable is an __asm__ like that.  So it would leave the
copy of __res to t_10 and disallow t_10 to be subsituted.

I think this will resolve the problem, and I will look at it shortly.


-- 

amacleod at redhat dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |amacleod at redhat dot com
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-11-17 19:28:11
               date|                            |


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


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

* [Bug tree-optimization/29877] out of SSA (TER) extends variable life of variable beyond original declared
  2006-11-17 17:58 [Bug tree-optimization/29877] New: Tree optimization extends variable life of variable beyond original declared diego dot dompe at ridgerun dot com
  2006-11-17 18:31 ` [Bug tree-optimization/29877] out of SSA (TER) " pinskia at gcc dot gnu dot org
  2006-11-17 19:28 ` amacleod at redhat dot com
@ 2006-11-18  4:58 ` shinwell at gcc dot gnu dot org
  2006-11-18 18:20 ` amacleod at redhat dot com
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: shinwell at gcc dot gnu dot org @ 2006-11-18  4:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from shinwell at gcc dot gnu dot org  2006-11-18 04:57 -------
Created an attachment (id=12635)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12635&action=view)
Proposed patch

2006-11-17  Mark Shinwell  <shinwell@codesourcery.com>

        gcc/
        * tree-outof-ssa.c (check_replaceable): Deem assignments
        with register variables on their RHS to not be replaceable.

        gcc/testsuite/
        * gcc.target/arm/register-variables.c: New test.
        * gcc.dg/pr16194.c: Remove dg-error directive.


-- 


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


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

* [Bug tree-optimization/29877] out of SSA (TER) extends variable life of variable beyond original declared
  2006-11-17 17:58 [Bug tree-optimization/29877] New: Tree optimization extends variable life of variable beyond original declared diego dot dompe at ridgerun dot com
                   ` (2 preceding siblings ...)
  2006-11-18  4:58 ` shinwell at gcc dot gnu dot org
@ 2006-11-18 18:20 ` amacleod at redhat dot com
  2006-11-24  2:19 ` [Bug tree-optimization/29877] [4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: amacleod at redhat dot com @ 2006-11-18 18:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from amacleod at redhat dot com  2006-11-18 18:20 -------
Yes, I think that is sufficient. I beleive all register variables have to be
loaded into an SSA_NAME like this before they can be used, and they all have to
have a virtual operand. So it should be good.

You beat me to it :-)

Andrew


-- 


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


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

* [Bug tree-optimization/29877] [4.0/4.1/4.2 Regression] out of SSA (TER) extends variable life of variable beyond original declared
  2006-11-17 17:58 [Bug tree-optimization/29877] New: Tree optimization extends variable life of variable beyond original declared diego dot dompe at ridgerun dot com
                   ` (3 preceding siblings ...)
  2006-11-18 18:20 ` amacleod at redhat dot com
@ 2006-11-24  2:19 ` pinskia at gcc dot gnu dot org
  2007-01-08  8:34 ` [Bug tree-optimization/29877] [4.0/4.1/4.2/4.3 " shinwell at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-24  2:19 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
            Summary|out of SSA (TER) extends    |[4.0/4.1/4.2 Regression] out
                   |variable life of variable   |of SSA (TER) extends
                   |beyond original declared    |variable life of variable
                   |                            |beyond original declared
   Target Milestone|---                         |4.0.4


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


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

* [Bug tree-optimization/29877] [4.0/4.1/4.2/4.3 Regression] out of SSA (TER) extends variable life of variable beyond original declared
  2006-11-17 17:58 [Bug tree-optimization/29877] New: Tree optimization extends variable life of variable beyond original declared diego dot dompe at ridgerun dot com
                   ` (4 preceding siblings ...)
  2006-11-24  2:19 ` [Bug tree-optimization/29877] [4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
@ 2007-01-08  8:34 ` shinwell at gcc dot gnu dot org
  2007-02-03 20:58 ` [Bug tree-optimization/29877] [4.0/4.1/4.2 " gdr at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: shinwell at gcc dot gnu dot org @ 2007-01-08  8:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from shinwell at gcc dot gnu dot org  2007-01-08 08:33 -------
Subject: Bug 29877

Author: shinwell
Date: Mon Jan  8 08:33:42 2007
New Revision: 120571

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120571
Log:
        PR tree-optimization/29877
        gcc/
        * tree-ssa-ter.c (is_replaceable_p): Deem assignments with
        a register variable on the RHS to not be replaceable.

        gcc/testsuite/
        * gcc.dg/pr16194.c: Skip test entirely if we don't know the
        name of a hard register for the target concerned.  Adjust dg-error
        directives to cope with new behaviour of TER.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/pr16194.c
    trunk/gcc/tree-ssa-ter.c


-- 


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


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

* [Bug tree-optimization/29877] [4.0/4.1/4.2 Regression] out of SSA (TER) extends variable life of variable beyond original declared
  2006-11-17 17:58 [Bug tree-optimization/29877] New: Tree optimization extends variable life of variable beyond original declared diego dot dompe at ridgerun dot com
                   ` (5 preceding siblings ...)
  2007-01-08  8:34 ` [Bug tree-optimization/29877] [4.0/4.1/4.2/4.3 " shinwell at gcc dot gnu dot org
@ 2007-02-03 20:58 ` gdr at gcc dot gnu dot org
  2007-02-03 21:03 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: gdr at gcc dot gnu dot org @ 2007-02-03 20:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from gdr at gcc dot gnu dot org  2007-02-03 20:57 -------
won't fix in GCC-4.0.x.  Adjusting milestone.


-- 

gdr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.4                       |4.1.3


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


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

* [Bug tree-optimization/29877] [4.0/4.1/4.2 Regression] out of SSA (TER) extends variable life of variable beyond original declared
  2006-11-17 17:58 [Bug tree-optimization/29877] New: Tree optimization extends variable life of variable beyond original declared diego dot dompe at ridgerun dot com
                   ` (6 preceding siblings ...)
  2007-02-03 20:58 ` [Bug tree-optimization/29877] [4.0/4.1/4.2 " gdr at gcc dot gnu dot org
@ 2007-02-03 21:03 ` pinskia at gcc dot gnu dot org
  2007-02-05  5:25 ` mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-03 21:03 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.3                       |4.1.2


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


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

* [Bug tree-optimization/29877] [4.0/4.1/4.2 Regression] out of SSA (TER) extends variable life of variable beyond original declared
  2006-11-17 17:58 [Bug tree-optimization/29877] New: Tree optimization extends variable life of variable beyond original declared diego dot dompe at ridgerun dot com
                   ` (7 preceding siblings ...)
  2007-02-03 21:03 ` pinskia at gcc dot gnu dot org
@ 2007-02-05  5:25 ` mmitchel at gcc dot gnu dot org
  2007-02-14  9:19 ` mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-02-05  5:25 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug tree-optimization/29877] [4.0/4.1/4.2 Regression] out of SSA (TER) extends variable life of variable beyond original declared
  2006-11-17 17:58 [Bug tree-optimization/29877] New: Tree optimization extends variable life of variable beyond original declared diego dot dompe at ridgerun dot com
                   ` (8 preceding siblings ...)
  2007-02-05  5:25 ` mmitchel at gcc dot gnu dot org
@ 2007-02-14  9:19 ` mmitchel at gcc dot gnu dot org
  2007-03-09 18:12 ` amacleod at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-02-14  9:19 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.2                       |4.1.3


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


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

* [Bug tree-optimization/29877] [4.0/4.1/4.2 Regression] out of SSA (TER) extends variable life of variable beyond original declared
  2006-11-17 17:58 [Bug tree-optimization/29877] New: Tree optimization extends variable life of variable beyond original declared diego dot dompe at ridgerun dot com
                   ` (9 preceding siblings ...)
  2007-02-14  9:19 ` mmitchel at gcc dot gnu dot org
@ 2007-03-09 18:12 ` amacleod at gcc dot gnu dot org
  2007-03-12  5:07 ` [Bug tree-optimization/29877] [4.0/4.1 " pinskia at gcc dot gnu dot org
  2008-07-04 15:55 ` [Bug tree-optimization/29877] [4.1 " jsm28 at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: amacleod at gcc dot gnu dot org @ 2007-03-09 18:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from amacleod at redhat dot com  2007-03-09 18:11 -------
Subject: Bug 29877

Author: amacleod
Date: Fri Mar  9 18:11:40 2007
New Revision: 122754

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=122754
Log:
2006-03-09  Mark Shinwell  <shinwell@codesourcery.com>
            Andrew MacLeod  <amacleod@redhat.com>

        PR tree-optimization/29877
        * tree-outof-ssa.c (check_replaceable): Don't allow TER to replace
        an expression if the RHS is a register variable.

        testsuite
        * gcc.dg/pr16194.c: Skip test entirely if we don't know the name of
        a hard register for the target concerned.


Modified:
    branches/gcc-4_2-branch/gcc/ChangeLog
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_2-branch/gcc/testsuite/gcc.dg/pr16194.c
    branches/gcc-4_2-branch/gcc/tree-outof-ssa.c


-- 


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


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

* [Bug tree-optimization/29877] [4.0/4.1 Regression] out of SSA (TER) extends variable life of variable beyond original declared
  2006-11-17 17:58 [Bug tree-optimization/29877] New: Tree optimization extends variable life of variable beyond original declared diego dot dompe at ridgerun dot com
                   ` (10 preceding siblings ...)
  2007-03-09 18:12 ` amacleod at gcc dot gnu dot org
@ 2007-03-12  5:07 ` pinskia at gcc dot gnu dot org
  2008-07-04 15:55 ` [Bug tree-optimization/29877] [4.1 " jsm28 at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-03-12  5:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pinskia at gcc dot gnu dot org  2007-03-12 05:07 -------
*** Bug 31143 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kaminaga at sm dot sony dot
                   |                            |co dot jp


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


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

* [Bug tree-optimization/29877] [4.1 Regression] out of SSA (TER) extends variable life of variable beyond original declared
  2006-11-17 17:58 [Bug tree-optimization/29877] New: Tree optimization extends variable life of variable beyond original declared diego dot dompe at ridgerun dot com
                   ` (11 preceding siblings ...)
  2007-03-12  5:07 ` [Bug tree-optimization/29877] [4.0/4.1 " pinskia at gcc dot gnu dot org
@ 2008-07-04 15:55 ` jsm28 at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 15:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jsm28 at gcc dot gnu dot org  2008-07-04 15:54 -------
Closing 4.1 branch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.1.3                       |4.2.0


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


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

end of thread, other threads:[~2008-07-04 15:55 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-17 17:58 [Bug tree-optimization/29877] New: Tree optimization extends variable life of variable beyond original declared diego dot dompe at ridgerun dot com
2006-11-17 18:31 ` [Bug tree-optimization/29877] out of SSA (TER) " pinskia at gcc dot gnu dot org
2006-11-17 19:28 ` amacleod at redhat dot com
2006-11-18  4:58 ` shinwell at gcc dot gnu dot org
2006-11-18 18:20 ` amacleod at redhat dot com
2006-11-24  2:19 ` [Bug tree-optimization/29877] [4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
2007-01-08  8:34 ` [Bug tree-optimization/29877] [4.0/4.1/4.2/4.3 " shinwell at gcc dot gnu dot org
2007-02-03 20:58 ` [Bug tree-optimization/29877] [4.0/4.1/4.2 " gdr at gcc dot gnu dot org
2007-02-03 21:03 ` pinskia at gcc dot gnu dot org
2007-02-05  5:25 ` mmitchel at gcc dot gnu dot org
2007-02-14  9:19 ` mmitchel at gcc dot gnu dot org
2007-03-09 18:12 ` amacleod at gcc dot gnu dot org
2007-03-12  5:07 ` [Bug tree-optimization/29877] [4.0/4.1 " pinskia at gcc dot gnu dot org
2008-07-04 15:55 ` [Bug tree-optimization/29877] [4.1 " jsm28 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).