mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-01-03 05:40:12 +01:00
make_and_run_test_nodes: avoid undefined behaviour
In code that looks like n[i] = v(&i), where v increments i, C leaves it undefined whether the old or new value of i is used to locate n[i]. As it happens, gcc used the pre-increment value of i, but MSVC used the post-increment value. Fix this by inserting a sequence point to disambiguate the intended order. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69924 Reviewed-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk> [wrote commit message, fixed whitespace -smcv] Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
This commit is contained in:
parent
ba7b857118
commit
7c00ed22d9
1 changed files with 5 additions and 2 deletions
|
|
@ -1785,10 +1785,13 @@ make_and_run_test_nodes (void)
|
|||
start_next_test ("All values in one big toplevel %d iteration\n", 1);
|
||||
{
|
||||
TestTypeNode *nodes[N_VALUES];
|
||||
TestTypeNode *node;
|
||||
|
||||
i = 0;
|
||||
while ((nodes[i] = value_generator (&i)))
|
||||
;
|
||||
while ((node = value_generator (&i)))
|
||||
{
|
||||
nodes[i - 1] = node;
|
||||
}
|
||||
|
||||
run_test_nodes (nodes, N_VALUES);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue