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

--- Comment #11 from Rafał Mużyło <galtgendo at o2 dot pl> 2012-07-02 19:38:29 
UTC ---
OK, I don't know if it's related, but 
https://bugs.gentoo.org/show_bug.cgi?id=424475
and its follow-up
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11845

This code:
int
find_stack_direction ()
{
  static char *addr = 0;
  auto char dummy;
  if (addr == 0)
    {
      addr = &dummy;
      return find_stack_direction ();
    }
  else
    return (&dummy > addr) ? 1 : -1;
}

int
main ()
{
  return find_stack_direction () < 0;
}

works with '-O2' and gcc 4.6.3, breaks on the same compiler with '-O3'
works with both '-O2' and '-O3' on 4.7.1.

On an interesting note, it works with both '-O2' and '-O3' on 4.5.3 too.

Reply via email to