This is the mail archive of the gcc@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]

Re: g++.old-deja/g++.mike/p7325.C - suspected bogus test case


Zack Weinberg <zack@codesourcery.com> writes:

> > (By the way, given this analysis, your stack-frame dumping switch
> > wouldn't help; the problem is that we don't really have a good method
> > for saying when the compiler must reuse stack slots and when it must
> > not.  Probably best to measure the total stack usage of some
> > representative program(s) -- of which this might be one.)
> 
> Good point.  I know this is a critical issue for Linux kernel
> development, and I would expect it to be the same for embedded
> environments - both are places where the total available stack 
> for a thread is very small.  Perhaps we could get some input
> from people in those domains on how to measure this?

Stack size usage is easy to measure in an execution test.  Is that
what you are asking?

For example, here is a quickie test for whether arrays declared in
different blocks overlap.  This test appears to currently always fail.

Ian

extern char *stack (void) __attribute__ ((__noinline__));

char *
foo ()
{
  {
    char b[100];
    memset (b, 0, sizeof b);
  }
  {
    char c[100];
    memset (c, 0, sizeof c);
  }
  return stack ();
}

int
main ()
{
  char a;
  char *p1, *p2;

  p1 = foo ();
  if (abs (&a - p1) >= 150)
    abort ();
  exit (0);
}

char *
stack ()
{
  char a;
  memset (&a, 1, sizeof a);
  return &a;
}


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