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



--- Comment #2 from Jens Maurer <jens.maurer at gmx dot net> 2012-11-23 
14:07:34 UTC ---

Here is another test case:





struct S {

  unsigned char * p;

  unsigned char * limit;

};



S g(S s);



inline __attribute__((always_inline)) S f(S s, unsigned int n);



S f(S s, unsigned int n)

{

  if (__builtin_expect(s.p + n < s.limit, 1)) {

    s.p += n;

    return s;

  }

  return g(s);

}



extern S sext;



int main()

{

  S s = sext;

  s = f(s, 4);

  s = f(s, 8);

  s = f(s, 2);

  return (int)(unsigned long)s.p;

}





leading to

        movq    %rax, (%rsp)

        movq    %rdx, 8(%rsp)

in the code paths calling g(s), although "s" is kept in registers throughout.

Reply via email to