selftests/powerpc/ptrace: Declare test temporary variables as volatile
authorBenjamin Gray <bgray@linux.ibm.com>
Tue, 25 Jul 2023 00:58:41 +0000 (10:58 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 2 Aug 2023 12:22:19 +0000 (22:22 +1000)
commitc3062ede9927053754ba27b280afe00b9b31b37a
tree4e0203e5987cd828c1d9d1586e5598664a8971ad
parentfc6732a8556c1099b89f4777a96bd6a1ae5a4378
selftests/powerpc/ptrace: Declare test temporary variables as volatile

While the target is volatile, the temporary variables used to access the
target cast away the volatile. This is undefined behaviour, and a
compiler may optimise away/reorder these accesses, breaking the test.

This was observed with GCC 13.1.1, but it can be difficult to reproduce
because of the dependency on compiler behaviour.

Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230725005841.28854-5-bgray@linux.ibm.com
tools/testing/selftests/powerpc/ptrace/ptrace-hwbreak.c