Blame SOURCES/avoid-undefined-7c00ed22d9b5c33f5b33221e906946b11a9bde3b.patch

9668f6
From 7c00ed22d9b5c33f5b33221e906946b11a9bde3b Mon Sep 17 00:00:00 2001
9668f6
From: DreamNik <dreamnik@mail.ru>
9668f6
Date: Sun, 29 Sep 2013 10:45:58 +0000
9668f6
Subject: make_and_run_test_nodes: avoid undefined behaviour
9668f6
9668f6
In code that looks like n[i] = v(&i), where v increments i, C leaves it
9668f6
undefined whether the old or new value of i is used to locate n[i].
9668f6
As it happens, gcc used the pre-increment value of i, but MSVC
9668f6
used the post-increment value.
9668f6
9668f6
Fix this by inserting a sequence point to disambiguate the intended order.
9668f6
9668f6
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69924
9668f6
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
9668f6
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9668f6
[wrote commit message, fixed whitespace -smcv]
9668f6
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9668f6
---
9668f6
diff --git a/dbus/dbus-marshal-recursive-util.c b/dbus/dbus-marshal-recursive-util.c
9668f6
index 9512414..a2aaaf9 100644
9668f6
--- a/dbus/dbus-marshal-recursive-util.c
9668f6
+++ b/dbus/dbus-marshal-recursive-util.c
9668f6
@@ -1785,10 +1785,13 @@ make_and_run_test_nodes (void)
9668f6
   start_next_test ("All values in one big toplevel %d iteration\n", 1);
9668f6
   {
9668f6
     TestTypeNode *nodes[N_VALUES];
9668f6
+    TestTypeNode *node;
9668f6
 
9668f6
     i = 0;
9668f6
-    while ((nodes[i] = value_generator (&i)))
9668f6
-      ;
9668f6
+    while ((node = value_generator (&i)))
9668f6
+      {
9668f6
+        nodes[i - 1] = node;
9668f6
+      }
9668f6
 
9668f6
     run_test_nodes (nodes, N_VALUES);
9668f6
 
9668f6
--
9668f6
cgit v0.9.0.2-2-gbebe