summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaichi Hirono2017-06-20 02:18:32 -0500
committerDaichi Hirono2017-06-22 21:23:12 -0500
commita6dee5e279de56751238f750d12f8a6237992043 (patch)
tree7408416a81a391cf55d78b9836e358d9a7047bc3 /libappfuse
parente37c3df0e8cfff6ef5819053317ff1df2de5e370 (diff)
downloadplatform-system-core-a6dee5e279de56751238f750d12f8a6237992043.tar.gz
platform-system-core-a6dee5e279de56751238f750d12f8a6237992043.tar.xz
platform-system-core-a6dee5e279de56751238f750d12f8a6237992043.zip
Add volatile to temporary variable.
FuseBuffer::HandleNotImpl save the value of |request.header.unique| to the temporary variable, clear the buffer which is a union of |request| and |response|, then write back the unique value to response.header.unique. Before the CL, the temporary variable was wrongly removed by the compiler optimization, and response.header.unique was always 0. The CL adds volatile modifier as workaround to prevent the compiler optimization from removing the temporary value. Bug: 62429763 Test: libappfuse_tests Change-Id: Ia853f805633f646f316f585a35c7b018000b6eb3
Diffstat (limited to 'libappfuse')
-rw-r--r--libappfuse/FuseBuffer.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/libappfuse/FuseBuffer.cc b/libappfuse/FuseBuffer.cc
index 1b47e0a35..1eab46cb4 100644
--- a/libappfuse/FuseBuffer.cc
+++ b/libappfuse/FuseBuffer.cc
@@ -251,7 +251,9 @@ void FuseBuffer::HandleInit() {
251void FuseBuffer::HandleNotImpl() { 251void FuseBuffer::HandleNotImpl() {
252 LOG(VERBOSE) << "NOTIMPL op=" << request.header.opcode << " uniq=" 252 LOG(VERBOSE) << "NOTIMPL op=" << request.header.opcode << " uniq="
253 << request.header.unique << " nid=" << request.header.nodeid; 253 << request.header.unique << " nid=" << request.header.nodeid;
254 const uint64_t unique = request.header.unique; 254 // Add volatile as a workaround for compiler issue which removes the temporary
255 // variable.
256 const volatile uint64_t unique = request.header.unique;
255 response.Reset(0, -ENOSYS, unique); 257 response.Reset(0, -ENOSYS, unique);
256} 258}
257 259