Bug in __asm with absolute addresses?  
Author Message
Myria





PostPosted: Visual C++ General, Bug in __asm with absolute addresses? Top

I was trying to intentionally cause a STATUS_ACCESS_VIOLATION exception, so I did this:

__asm { mov eax, [0] }

However, the compiler assembled this as B8 00 00 00 00, or "mov eax, 0".

I'm using VC8 Service Pack 1.



Visual C++8  
 
 
Mike Danes





PostPosted: Visual C++ General, Bug in __asm with absolute addresses? Top

Put a ds: in front of [0]:

__asm { mov eax, ds:[0] }

In any case, you don't need assembly to generate a STATUS_ACCESS_VIOLATION, some C code would do:

int *p = NULL;

int v = *p;