||Yeah macros are tricky to get right. In this case the bug is in the way the macro is written, which ought to be
#define abs(x) ((x) > 0 ? (x) : (-(x)))
i.e., another layer of brackets on the outside. It's still bad that it's a macro at all in this day and age though, since if "x" is an expression with side effects then it will be evaluated multiple times. GCC has some extensions to get around this (statement-expressions), but it really ought to just be a static inline function.