←back to thread

The provenance memory model for C

(gustedt.wordpress.com)
225 points HexDecOctBin | 4 comments | | HN request time: 0.877s | source
1. gavinray ◴[] No.44422412[source]
Also of interest to folks looking at this might be TySan, the recently-merged LLVM Type-Based Aliasing sanitizer:

https://clang.llvm.org/docs/TypeSanitizer.html

https://www.phoronix.com/news/LLVM-Merge-TySan-Type-Sanitize...

replies(2): >>44426467 #>>44430826 #
2. aengelke ◴[] No.44426467[source]
It's probably worth noting that TySan currently only catches aliasing violations that LLVM would be able to exploit. For some types, e.g. unions, Clang doesn't emit accurate type-based aliasing information and therefore TySan won't catch these.
replies(1): >>44428607 #
3. flohofwoe ◴[] No.44428607[source]
Which is fine I think, considering that union type punning is legal in C (and even in C++ where union type punning is UB I have never seen it break - theoretically it might of course).
4. uecker ◴[] No.44430826[source]
The problem might be that Clang does not even implement type-based aliasing correctly. So I assume it checks its broken rules, instead of the one specified in the C standard.