Hi Erik,
On Monday 02 January 2006 14:53, Erik Hofman wrote:
> # define PUSH(r) do { \
> if(ctx->opTop >= MAX_STACK_DEPTH) ERR(ctx, "stack overflow"); \
> ctx->opStack[ctx->opTop++] = r; \
> } while(0)
[...]
> The only thing I can think of right now is that inside the function the
> code is working with a *copy* of r
>
> I'm puzzled.
I am not sure, but for the first thing, the lines around 427 look suspicious
to me. They also reference opTop from the ctx variable which is modified by
the macro.
I believe that the order of the increment and the assignent of the array is
undefined in this macro expansion.
I beileve that the compiler might be free to interpret the following:
ctx->opStack[ctx->opTop++] = ctx->opStack[ctx->opTop-1];
to either:
int tmpindex = ctx->opTop;
ctx->opStack[tmpindex] = ctx->opStack[ctx->opTop-1];
ctx->opTop++;
or
int tmpindex = ctx->opTop;
ctx->opTop++;
ctx->opStack[tmpindex] = ctx->opStack[ctx->opTop-1];
which is obviously not the same.
Good detective work Erik!
Greetings and happy new year
Mathias
--
Mathias Fröhlich, email: [EMAIL PROTECTED]
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel