]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-29939: suppress compiler warnings in _ctypes_test (#1038)
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Fri, 7 Apr 2017 22:23:08 +0000 (23:23 +0100)
committerGitHub <noreply@github.com>
Fri, 7 Apr 2017 22:23:08 +0000 (23:23 +0100)
bpo-29939: Changed test code to suppress a compiler warning, while taking care to avoid the code being optimized out by the compiler.
(cherry picked from commit 164d30eb1e66575dafee6af4fca4cbf52c7fbe6a)

Modules/_ctypes/_ctypes_test.c

index 59d56d0d218732bd850a8cc47a227ae36e247637..6119ecdaf90dc6e413afe09d6b2178416ba026a0 100644 (file)
@@ -52,9 +52,9 @@ _testfunc_cbk_large_struct(Test in, void (*func)(Test))
 EXPORT(void)
 _testfunc_large_struct_update_value(Test in)
 {
-    in.first = 0x0badf00d;
-    in.second = 0x0badf00d;
-    in.third = 0x0badf00d;
+    ((volatile Test *)&in)->first = 0x0badf00d;
+    ((volatile Test *)&in)->second = 0x0badf00d;
+    ((volatile Test *)&in)->third = 0x0badf00d;
 }
 
 EXPORT(void)testfunc_array(int values[4])