GCC 7.2 reports 3 violations of the C standard's sequence point rules (i.e., due to -Wsequence-point). These are places in the code where the order of expression evaluation is undefined, so the compiler may or may not give you the order you expect. The attached patch forces the correct ordering.
could you please copy/paste the gcc diagnostic messages?
thanks!