[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131119220840.GB892@tucnak.redhat.com>
Date: Tue, 19 Nov 2013 23:08:40 +0100
From: Jakub Jelinek <jakub@...hat.com>
To: Richard Henderson <rth@...ddle.net>
Cc: Peter Zijlstra <peterz@...radead.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Will Deacon <will.deacon@....com>,
linux-kernel@...r.kernel.org,
Catalin Marinas <Catalin.Marinas@....com>,
lttng-dev@...ts.lttng.org, Nathan Lynch <Nathan_Lynch@...tor.com>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
"gcc@....gnu.org" <gcc@....gnu.org>
Subject: Re: Multiple local register variables w/ same register
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists