Paul Eggert wrote:
> converting a pointer to uintptr_t and back means that GCC won't connect 
> the resulting pointer to the original and this messes up bounds checking 
> on the result.

I don't observe this. This test program:

==============================================
#include <stdlib.h>
#include <stdint.h>

int main ()
{
  int n = 100;
  char *mem = malloc (n);
  char* p = (char *) (uintptr_t) mem;
  p[-2] = 'x';
  p[n] = 'z';
  return 0;
}
==============================================
when compiled with "gcc -mmpx -fcheck-pointer-bounds" (gcc 7.3.0),
produces

Saw a #BR! status 1 at 0x4005c8
Saw a #BR! status 1 at 0x4005e4

Bruno


Reply via email to