Re: obvious race condition in darwin/netbsd __enable_execute_stack due to caching pagesize/mask

2008-08-27 Thread Andrew Pinski
On Wed, Aug 27, 2008 at 11:47 AM, Jay <[EMAIL PROTECTED]> wrote: > >> "(volatile*) > > So this is using implied int then? > Isn't that really considered to be avoided these days? Or perfectly ok in C? > I know it is "legal", but I assume to be avoided as a matter of taste and C++ > compat. > Or yo

RE: obvious race condition in darwin/netbsd __enable_execute_stack due to caching pagesize/mask

2008-08-27 Thread Jay
> "(volatile*) So this is using implied int then? Isn't that really considered to be avoided these days? Or perfectly ok in C? I know it is "legal", but I assume to be avoided as a matter of taste and C++ compat. Or you can really omit the type I think not. Might be a nice extension though

Re: obvious race condition in darwin/netbsd __enable_execute_stack due to caching pagesize/mask

2008-08-27 Thread Daniel Jacobowitz
On Wed, Aug 27, 2008 at 02:45:25PM +0100, Dave Korn wrote: > Jay wrote on 27 August 2008 09:55: > > > Yeah that's probably ok. > > Volatile is enough to force the ordering? > > Absolutely; it's a defined part of the standard that all volatile > side-effects must complete in-order. GCC will not

Re: obvious race condition in darwin/netbsd __enable_execute_stack due to caching pagesize/mask

2008-08-27 Thread Michael N. Moran
Andrew Thomas Pinski wrote: On Aug 27, 2008, at 0:27, Jay <[EMAIL PROTECTED]> wrote: size = getpagesize(); \ mask = ~((long) size - 1); Or even better store size after the store to mask. That is: int tmp = getpagesize(); *(volatile*)&mask = ~((long)tm

RE: obvious race condition in darwin/netbsd __enable_execute_stack due to caching pagesize/mask

2008-08-27 Thread Dave Korn
Jay wrote on 27 August 2008 09:55: > Yeah that's probably ok. > Volatile is enough to force the ordering? Absolutely; it's a defined part of the standard that all volatile side-effects must complete in-order. GCC will not move code past a volatile operation. > I still like just not caching ma

RE: obvious race condition in darwin/netbsd __enable_execute_stack due to caching pagesize/mask

2008-08-27 Thread Jay
Yeah that's probably ok. Volatile is enough to force the ordering? I still like just not caching mask. Is "volatile*" legal or just pseudo? Some platforms cache neither. Are some platforms getpagesize slow and others fast? Or it's just "random evolution"? If it's just "random", and nobody knows g

Re: obvious race condition in darwin/netbsd __enable_execute_stack due to caching pagesize/mask

2008-08-27 Thread Andrew Thomas Pinski
Sent from my iPhone On Aug 27, 2008, at 0:27, Jay <[EMAIL PROTECTED]> wrote: gcc 4.3.1 config/darwin.h: #define ENABLE_EXECUTE_STACK\ extern void __enable_execute_stack (void *);\ void

obvious race condition in darwin/netbsd __enable_execute_stack due to caching pagesize/mask

2008-08-27 Thread Jay
gcc 4.3.1 config/darwin.h: #define ENABLE_EXECUTE_STACK\ extern void __enable_execute_stack (void *);\ void\ __enable_execute_s