public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/26608]  New: address of local variables are said to escape even though it is obvious they don't
@ 2006-03-08 18:59 pinskia at gcc dot gnu dot org
  2006-03-08 19:44 ` Daniel Berlin
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-08 18:59 UTC (permalink / raw)
  To: gcc-bugs

Testcase:
int *d1;
int g(int *b)
{
  d1 = b;
}
int f(int a, int b, int c)
{
  int i, j;
  int *d;
  if (a)
    d = &i;
  else
    d = &j;
  i = 2;
  j = 3;
  g(&b);
  if (i!=2)
   link_error();
  if (j!=3)
   link_error();
  return *d;
}
int main(void)
{
  f(1, 2,3);
  return 0;
}

This should link with optimize but right now i and j are said to be call
clobbered for some reason.


-- 
           Summary: address of local variables are said to escape even
                    though it is obvious they don't
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, alias
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org


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


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

* Re: [Bug tree-optimization/26608]  New: address of local variables  are said to escape even though it is obvious they don't
  2006-03-08 18:59 [Bug tree-optimization/26608] New: address of local variables are said to escape even though it is obvious they don't pinskia at gcc dot gnu dot org
@ 2006-03-08 19:44 ` Daniel Berlin
  2006-03-08 19:44 ` [Bug tree-optimization/26608] " dberlin at dberlin dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Daniel Berlin @ 2006-03-08 19:44 UTC (permalink / raw)
  To: gcc-bugzilla; +Cc: gcc-bugs

On Wed, 2006-03-08 at 18:59 +0000, pinskia at gcc dot gnu dot org wrote:
> Testcase:
> int *d1;
> int g(int *b)
> {
>   d1 = b;
> }
> int f(int a, int b, int c)
> {
>   int i, j;
>   int *d;
>   if (a)
>     d = &i;
>   else
>     d = &j;
>   i = 2;
>   j = 3;
>   g(&b);
>   if (i!=2)
>    link_error();
>   if (j!=3)
>    link_error();
>   return *d;
> }
> int main(void)
> {
>   f(1, 2,3);
>   return 0;
> }
> 
> This should link with optimize but right now i and j are said to be call
> clobbered for some reason.

What does the dump say.
My guess is that it believes that they are returned from the call, even
though they are not.

> 
> 


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

* [Bug tree-optimization/26608] address of local variables are said to escape even though it is obvious they don't
  2006-03-08 18:59 [Bug tree-optimization/26608] New: address of local variables are said to escape even though it is obvious they don't pinskia at gcc dot gnu dot org
  2006-03-08 19:44 ` Daniel Berlin
@ 2006-03-08 19:44 ` dberlin at dberlin dot org
  2006-03-08 19:47 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dberlin at dberlin dot org @ 2006-03-08 19:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dberlin at gcc dot gnu dot org  2006-03-08 19:44 -------
Subject: Re:   New: address of local variables
        are said to escape even though it is obvious they don't

On Wed, 2006-03-08 at 18:59 +0000, pinskia at gcc dot gnu dot org wrote:
> Testcase:
> int *d1;
> int g(int *b)
> {
>   d1 = b;
> }
> int f(int a, int b, int c)
> {
>   int i, j;
>   int *d;
>   if (a)
>     d = &i;
>   else
>     d = &j;
>   i = 2;
>   j = 3;
>   g(&b);
>   if (i!=2)
>    link_error();
>   if (j!=3)
>    link_error();
>   return *d;
> }
> int main(void)
> {
>   f(1, 2,3);
>   return 0;
> }
> 
> This should link with optimize but right now i and j are said to be call
> clobbered for some reason.

What does the dump say.
My guess is that it believes that they are returned from the call, even
though they are not.

> 
> 


-- 


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


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

* [Bug tree-optimization/26608] address of local variables are said to escape even though it is obvious they don't
  2006-03-08 18:59 [Bug tree-optimization/26608] New: address of local variables are said to escape even though it is obvious they don't pinskia at gcc dot gnu dot org
  2006-03-08 19:44 ` Daniel Berlin
  2006-03-08 19:44 ` [Bug tree-optimization/26608] " dberlin at dberlin dot org
@ 2006-03-08 19:47 ` pinskia at gcc dot gnu dot org
  2006-09-12  6:37 ` pinskia at gcc dot gnu dot org
  2009-04-03 12:24 ` rguenth at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-08 19:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-03-08 19:47 -------
Variable: i, UID 1520, int, is aliased, is addressable, default def: i_3

Variable: j, UID 1521, int, is aliased, is addressable, default def: j_5

Variable: b, UID 1516, int, is aliased, is addressable, call clobbered (,
passed to call )

Variable: SMT.30, UID 1569, int, is addressable, call clobbered (, passed to
call ), may aliases: { i j b }

Hmm, it does not say why i and j are thought to be call clobbered but it looks
like it is because the SMT is call clobbered.


-- 


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


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

* [Bug tree-optimization/26608] address of local variables are said to escape even though it is obvious they don't
  2006-03-08 18:59 [Bug tree-optimization/26608] New: address of local variables are said to escape even though it is obvious they don't pinskia at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-03-08 19:47 ` pinskia at gcc dot gnu dot org
@ 2006-09-12  6:37 ` pinskia at gcc dot gnu dot org
  2009-04-03 12:24 ` rguenth at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-12  6:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2006-09-12 06:37 -------
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-09-12 06:37:43
               date|                            |


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


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

* [Bug tree-optimization/26608] address of local variables are said to escape even though it is obvious they don't
  2006-03-08 18:59 [Bug tree-optimization/26608] New: address of local variables are said to escape even though it is obvious they don't pinskia at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2006-09-12  6:37 ` pinskia at gcc dot gnu dot org
@ 2009-04-03 12:24 ` rguenth at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-03 12:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2009-04-03 12:24 -------
Works with 4.3.  Very similar to PR23086.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


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


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

end of thread, other threads:[~2009-04-03 12:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-08 18:59 [Bug tree-optimization/26608] New: address of local variables are said to escape even though it is obvious they don't pinskia at gcc dot gnu dot org
2006-03-08 19:44 ` Daniel Berlin
2006-03-08 19:44 ` [Bug tree-optimization/26608] " dberlin at dberlin dot org
2006-03-08 19:47 ` pinskia at gcc dot gnu dot org
2006-09-12  6:37 ` pinskia at gcc dot gnu dot org
2009-04-03 12:24 ` rguenth 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).