Unfortunately, even with that and it having been run with purify (a commercial predecessor to valgrind), i was still able to find some severe memory issues that didn’t manifest by compiling with address and memory sanitization about 25 years later.
ASAN is great because of its compatibility with existing libraries, as you have pointed out, is available in both gcc/clang. Valgrind is in the same league. Both are fantastic tools even though they might miss some errors.
It's dynamic typing.
How does type punning work? Does you compiler scribble the types a pointer has been cast to in the object descriptor?
In my mind I was picturing a double-wide pointer that (assuming 48-bit address spaces) carries 20 bits of type information, a pointer to an allocation descriptor, a pointer to / into the object, and 16-bit CRC of the allocation descriptor. The allocation descriptor itself would have a base address and size, a generation number, and maybe some bits for something else (what? perhaps another CRC?).
However, this would change the ABI...
And yes, I thought you were encoding the C type of the object pointed to in the pointer, which is why I was thinking wide pointers.
Thanks for the clarification!
It uses a completely different mechanism from the one used by ASAN and Valgrind.
Edit: delete a wrong answer.