g_string_append() macro evaluates arguments multiple times
Spotted by Coverity:
write_write_order: In g_string_append_len_inline(str, tmp[--i], (0 ? (gssize)strlen(tmp[--i]) : -1L)), i is written in 0 ? (gssize)strlen(tmp[--i]) : -1L and written in tmp[--i] but the order in which the side effects take place is undefined because there is no intervening sequence point.
Related to this call site: https://gitlab.gnome.org/GNOME/glib/-/blob/7514efab0572803653bba4b2117776de4e14a910/glib/gdatetime.c#L2947
The --i
gets evaluated multiple times because the macro version of g_string_append()
expands val
multiple times.