> The compiler sees
>
>     <memory input> := *(unsigned long*) 42
>
> which itself is indeed dereferencing a strange pointer. Probably GCC should
> warn about only pointers
> to known data.

Lazy solution for me would be something like the following:
Does it look correct?

#if defined(__MINGW32__) && defined(__x86_64__)
#undef NtCurrentTeb
#define NtCurrentTeb MI_NtCurrentTeb
struct _TEB * MI_NtCurrentTeb(void) {
  void *ret;
  __asm__ __volatile__ ("movq %%gs:0x30,%0" : "=r" (ret));
  return ret;
}
#elif defined(__MINGW32__) && defined(__i386__)
#undef NtCurrentTeb
#define NtCurrentTeb MI_NtCurrentTeb
struct _TEB * MI_NtCurrentTeb(void) {
  void *ret;
  __asm__ __volatile__ ("movl %%fs:0x18,%0" : "=r" (ret));
  return ret;
}
#endif


_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to