This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


> "(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.

"Someone" please fix. I don't have write access. Seems agreed best
fix is to not cache mask. Not cashing size seems goodness too but should
probably first read getpagesize on the affected systems (including older versions),
make sure it is just returning a constant, not making a syscall.

I'm also not sure about "left casting".

  int i = 123;  

  (*(char*)&i) = 0;  

Legal? Tangential and now moot I realize.
I understand the point, it is a common construct, but I've long wondered if the standard allows it.

I understand that:
  int i = 123;  
  volatile char* p = (volatile char*) &i; 
  *p = 0;  

  is legal -- with a type, and not "left".  

btw, I think the cache is also badness in that writable globals should be minimized.
In the interest of minimizing dirty pages, "dirtiable" pages, etc.
(ie: if you have 4k + 4 bytes of writable globals, saving 4 bytes probably saves 4k.)
It's also smaller code to not cache, of course.

Thanks,
 - Jay

> From: dave@
> [snip snip snip...]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]