[libcxx-commits] [libcxx] [ASan][libc++] Hotfix: String annotations stack frame size (PR #76192)
via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Dec 21 15:46:45 PST 2023
AdvenamTacet wrote:
I could be wrong or I cannot reproduce the result I had yesterday. I have an example showing that this code is not fully optimized out, but the stack frame is of the same size. The example: https://godbolt.org/z/GnY3zq13K (ugly one, because it shows the difference better than LLVM17 vs trunk).
This example compares old string implementation (no string annotations) with new string implementation (with changes from the PR already merged, but without changes from this PR). You can see different outputs.
If we apply this PR, we get another example (old string without changes, new string with this PR as well): https://godbolt.org/z/av8cYd3Ts
You can see that outputs are the same.
In general, differences are not visible in trivial code examples, so the smallest example I could create showing some difference is:
```cpp
std::string foo(std::string& s) {
std::string s2(std::move(s));
if(s2 == "x") {
return s;
} else {
return s2;
}
}
```
And you can see different output length for different sting versions without this PR. However, I cannot find an example showing different sizes of stack frames.
https://github.com/llvm/llvm-project/pull/76192
More information about the libcxx-commits
mailing list