This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/26608] New: address of local variables are said to escape even though it is obvious they don't


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]