Skip to content

Commit 0667b00

Browse files
committed
ICC also uses provenance
1 parent 9eda0ea commit 0667b00

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

text/0000-rust-has-provenance.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ The given program has UB, but the [alternative program](https://play.rust-lang.o
8787

8888
[^miri]: If you try running the given program in Miri, you might be surprised to see that Miri does not report UB. This is because the UB can only be detected when `ptr::eq(p1_ptr, p2_ptr)` is true, and with Miri's randomized allocator, that is unlikely. [Here is another version](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=88aaf7200e962050c140709fac24042c) that tries multiple possible offsets between `p1` and `p2`, and reliably triggers UB under current versions of Miri.
8989

90-
This optimization is performed by both [GCC](https://godbolt.org/z/G3jYEnWx6) and [clang](https://godbolt.org/z/cr7h6hhqf):
91-
in both cases, the program prints `42`, showing that the initial value of `p2` is printed, not the value that was written just above the `print` call -- despite the fact that that write definitely stores to the same address that `print` is printing from.
90+
This optimization is performed by both [GCC](https://godbolt.org/z/G3jYEnWx6), [clang](https://godbolt.org/z/cr7h6hhqf), and [ICC](https://godbolt.org/z/14b1d16Gc):
91+
in all cases, the program prints `42`, showing that the initial value of `p2` is printed, not the value that was written just above the `print` call -- despite the fact that that write definitely stores to the same address that `print` is printing from.
9292
This is not a new phenomenon either; it goes back at least to [GCC 4.6.4](https://godbolt.org/z/Yx6f389Gf) (released in 2013) and [clang 3.4.1](https://godbolt.org/z/nnhn6fdnj) (released in 2014).
9393
This demonstrates that both of them implement a language that has pointer provenance.[^cstandard]
9494

0 commit comments

Comments
 (0)