>511:  if ( (DWORD)psThreadData == 0x00000001)
>512:      psThreadData->bTerminate = FALSE ;

>The fact that *after* you check psThreadData to be 1, you access a
>member variable of it (effectively dereferencing it) should immediately
>lead to an exception (if run under debugger, or a crash, if run outside
>of one.)  So I just don't get the whole idea of the above if statement.

Sorry... I realise that does look confusing. Yes, indeed it would crash -
but it was never intended ot be executed. The whole point of that second
line was to put a breakpoint ON it, so that the debugger would stop AT it if
the condition was met, indicating that the corruption had occurred. It was
just a handy variable to use to have a breakpoint line - it's not real code!
{:v)

>>It did NOT hit the breakpoint set at lines 511 / 512, so the pointer
>>was still valid when it went into the call.
>
>Like I said above, if it did, then you would face an exception.  You're
>sure you have not made any such mistakes in these hot areas of the
>code we're discussing?

I promise, no such mistakes - purely for debugging purposes for breakpoint
lines to try and catch WHEN psThreadData got corrupted.

>Here's WaitForRX(), with the breakpoint I added and it triggered:
>
>DWORD WaitForRX(COMMS_RX_THREAD_DATA_S& rsThreadData,
>OVERLAPPED& rsNotifyOverlapData)
>
>Is this all the code without getting any part of it trimmed off?
>If this is all of it, then you might have caught a compiler bug!

This is it, nothing removed in between.

>A likely reason for this symptom is stack corruption, which is of course
>not likely if you have cited the complete code, because other than
>declaring some variables (which translates to shifting off the esp
register)
>you are not doing anything which can overflow/corrupt some part of the
>stack.  Anyway, one way of testing it is allocating a big char array (say,
>1KB) at the beginning of WaitForRX, and seeing if the problem occurs
>again.

I'm not quite sure how this would help - could you explain?

I can confirm that it does not stop the problem.

>Are you having deep recursive calles?  IOW, how deep is the stack
>trace when the breakpoint hits?

Just four levels, only two of which are mine - no recursion.

>This is why I suspect you've caught a compiler bug, provided that
>you have posted the code without any serious trim-offs.  :-)

I'm not sure whether I should woohoo! at that prospect, or throw a tantrum
{;v)

>>How is this possible?
>
>Magic.  Black Magic!
>
>OK I understand that you might not be in a position to tolerate
>my unbearable sense of humor, because at your situation I'd have
>been pulling my hair out, but please bear with me.  I'm just making
>the big test I'm gonna have in two days easier on myself...
>
>And don't worry, we'll track it down.

Actually, I'm unusually calm about it... I've come to accept that things
rarely work out the way I planned, so I just keep chipping away at the pile
of Life's little issues hoping one day to make a dent in it {;v)

--
Jason Teagle
[EMAIL PROTECTED]



_______________________________________________
msvc mailing list
[email protected]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for 
subscription changes, and list archive.

Reply via email to