Updates:
        Status: Invalid

Comment #1 on issue 395 by [email protected]: pointer not owned error when calling malloc_usable_size() on array of structs with destructors
https://code.google.com/p/address-sanitizer/issues/detail?id=395

I don't think we can do anything here.

new[] for non-trivially-destructible types doesn't return you the pointer to the allocated block of memory. It returns you a pointer *inside* the block of allocated memory (which is what ASan report tells you), as the beginning of allocated block contains an array cookie. I'm pretty sure malloc_usable_size() is not guaranteed to
work in this case. It actually doesn't work without ASan. If I add
  printf("%zu\n", malloc_usable_size(foo));
to your example I observe:

$ ./bin/clang++ tmp/test.cc ; ./a.out
18446744073709551608

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to