> Please take the hostility down a notch. I don't see why it's necessary.
I apologize (to both you and Kai) if that's how this came across. That 
was not my intent.  I routinely use weekends to work on new puzzles.  
The reason I suggested it would give him plenty to think about over the 
weekend is that's when I do my best thinking.

However, it would be utterly true to say that I am both insecure and 
defensive, and my posts no doubt reflect that.  I'm a gcc newbie here 
trying convince long-time experts that I know what I'm talking about in 
this really technical area.  That said, I will try harder to keep 
"attitude" out of my posts.  Continue to clobber me as appropriate.
> This is not the behavior I see. If I fix your buggy code to read
My goal with this (admittedly ugly) code was threefold:

1) Minimum code necessary to clearly reproduce the problem.
2) Allow for easier experimentation without changing a system include 
file.  Knowing me, I'd leave some bad definition in the header, then 
wonder why nothing worked anymore.
3) Minimize the confusion over which definition of __stosb is being used 
(see below).

> Sorry, I don't see any unexpected behavior here (solely by comparing 
> to MSVC output). So either I'm misunderstanding you, or what is 
> currently in MinGW-w64 is correct.

When I compile your code, I don't see the problem either.  However, 
that's because when using your code, we aren't using the inline 
assembler definition from winnt.h.  A quick look at the disassembly from 
my attempt to compile your code shows:

   402ce4:    call   402af0 <__stosb>

If we were using the inline code from winnt.h, there would be no "call", 
just the asm.  If I change your code to add:

#include <windows.h>

right after assert.h, I see the same problem again (0 2).  To see it 
work correctly, modify winnt.h to add the memory clobber:

     __CRT_INLINE VOID __stosb(PBYTE Dest,BYTE Data,SIZE_T Count)
     {
       __asm__ __volatile__
       (
         "rep; stosb" :
         [Dest] "=D" (Dest), [Count] "=c" (Count) :
         "[Dest]" (Dest), "a" (Data), "[Count]" (Count)
         : "memory"
       );
     }

NB: I don't believe this definition of __stosb is quite right either.  
But it's closer.  And it does illustrate the behavior of the memory 
clobber, which was the purpose of the post.

dw

------------------------------------------------------------------------------
Own the Future-Intel(R) Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest. Compete 
for recognition, cash, and the chance to get your game on Steam. 
$5K grand prize plus 10 genre and skill prizes. Submit your demo 
by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to