Incorrect evaluation for C operators that associate right-to-left. Frysk: (fhpd) print i 1 (fhpd) print i++ + ++i + i 7 But on a GCC compiler: int i=1; printf ("%d\n", i++ + ++i + i); Output: 6 Gdb also seems to have this bug: (gdb) print i $2 = 1 (gdb) print i++ + ++i + i $3 = 7
I believe this hits undefined behavior, because you change "i" twice between two sequence points. I would notabug this.
Even if I do something like: (fhpd) print i = 1 1 (fhpd) print i++ + i 3 frysk and gdb gives result 3, whereas C evaluates it to a 2, which is why I think its a bug with associativity.
But that expression has the same problem. You can't both change and read the number in one expression (or, more preciselly, between two sequence points). You may want to read the exact wording of the C or C++ standard, but FWIW, expressions like these always make me feel icky.
Closing bug. Would be a neat feature to get frysk to warn users of possibly undefined operations.