On Wed, Nov 20, 2013 at 07:56:57AM +1000, Richard Henderson wrote:
> It appears not:
> 
> int __attribute__((noinline)) f(void)
> {
>   {
>     register int x __asm__("eax");
>     x = 1;
>   }
>   {
>     register int y __asm__("eax");
>     return ++y;
>   }
> }
> 
> extern void abort(void);
> 
> int main(void)
> {
>   if (f() != 2)
>     abort();
>   return 0;
> }
> 
> Anyone see anything wrong with the testcase?  Do we thing this sort of thing
> ought to work, perhaps with scopes lengthened?

I'd say this is undefined, when a local register var goes out of scope,
it's value can change arbitrarily.  If you insert some call in between the
two scopes, it will surely have clobbered value, and even if there isn't
any call in between those, any insn could in theory clobber those.

        Jakub

Reply via email to