| commit | 7c350b9428c7d478559e25b368d0da66098d2cae | [log] [tgz] |
|---|---|---|
| author | nagendra modadugu <[email protected]> | Tue Oct 18 22:13:05 2016 |
| committer | chrome-bot <[email protected]> | Wed Oct 19 05:16:04 2016 |
| tree | 88bde8511d7aa0ecf89a3a2c6b454a272c688054 | |
| parent | 810f8b850c32a656e2b0ae49d8e606bfd781e5e7 [diff] |
Introduce a compiler-optimization safe memset() alternative memset() may be optimized away by the compiler if zero'ing is considered to have no side-effects. This change adds always_memset(), an implementation that indirects writes via a volatile pointer and hence survives optimization. Tested against x86-64 Clang 3.9.0, x86-64 Gcc 6.2, ARM64 gcc 4.8, and ARM gcc 4.8.2. BRANCH=none BUG=none TEST=compilation succeeds Change-Id: Ib1d3d0c0450bf2c95b3ffcf566a484e1db6a908d Signed-off-by: nagendra modadugu <[email protected]> Reviewed-on: https://chromium-review.googlesource.com/400467 Commit-Ready: Nagendra Modadugu <[email protected]> Tested-by: Nagendra Modadugu <[email protected]> Reviewed-by: Marius Schilder <[email protected]> Reviewed-by: Andrey Pronin <[email protected]>