Re: C as used/implemented in practice: analysis of responses

2015-06-29 Thread Peter Sewell
ack, thanks - in that case, it's a nice example, but not really relevant to what we're asking about Peter On 30 June 2015 at 00:21, Andreas Hollmann wrote: > Sorry for my first misleading email. The code needs disabled > optimizations to ensure that the execution time is long enough > to measur

Re: C as used/implemented in practice: analysis of responses

2015-06-29 Thread Andreas Hollmann
Sorry for my first misleading email. The code needs disabled optimizations to ensure that the execution time is long enough to measure jitter. It has nothing to do with the correctness of the C code. It might be still an issue, to depend on an optimization level. "To ensure that optimizations are

Re: C as used/implemented in practice: analysis of responses

2015-06-29 Thread Andreas Hollmann
There is some recent code added to Linux 4.2, that relies on disabled optimization. This might be an interesting case of unclear interpretation/misuse of the C language. #ifdef __OPTIMIZE__ #error "The CPU Jitter random number generator must not be compiled with optimizations. See documentation.

Re: C as used/implemented in practice: analysis of responses

2015-06-26 Thread Peter Sewell
On 26 June 2015 at 20:27, Joseph Myers wrote: > On Fri, 26 Jun 2015, Peter Sewell wrote: > >> > It's s simple matter of points-to analysis. &foo + anything may be >> > assumed (in practice) to point to something within foo (or just past the >> > end) and not to alias anything accessed through a p

Re: C as used/implemented in practice: analysis of responses

2015-06-26 Thread Joseph Myers
On Fri, 26 Jun 2015, Peter Sewell wrote: > > It's s simple matter of points-to analysis. &foo + anything may be > > assumed (in practice) to point to something within foo (or just past the > > end) and not to alias anything accessed through a pointer based on &bar. > > If the compiler can see som

Re: C as used/implemented in practice: analysis of responses

2015-06-26 Thread Peter Sewell
On 26 June 2015 at 18:08, Joseph Myers wrote: > On Fri, 26 Jun 2015, Peter Sewell wrote: > >> **If you calculate an offset between two separately allocated C memory >> objects (e.g. malloc'd regions or global or local variables) by >> pointer subtraction, can you make a usable pointer to the secon

Re: C as used/implemented in practice: analysis of responses

2015-06-26 Thread Joseph Myers
On Fri, 26 Jun 2015, Peter Sewell wrote: > **If you calculate an offset between two separately allocated C memory > objects (e.g. malloc'd regions or global or local variables) by > pointer subtraction, can you make a usable pointer to the second by > adding the offset to the address of the first?