testing the order of doing stuff
How about testing when the compiler promotes signed to unsigned? That was your original problem, not order precedence. Sneak in any unsigned into the mix of comparisons, and they all get treated as unsigned. Any unsigned result of unsigned comparison will be always be greater than 0, unless 0. Your first commented out line, the comparison becomes an unsigned comparison to 0 because you brought in the unsigned result of micros().
Here's a start-
uint32_t a = 0;
int32_t b = -1;
printf("%u + %d > 0 ? %s\r\n", a, b, a+b>0 ? "true" : "false");
//0 + -1 > 0 ? true
a+b should be -1, but its unsigned result of addition is 0xFFFFFFFF, which is greater than 0, so a+b > 0 is true.
Now make them all signed (the 0 is a signed number by default), and you get what is expected-
int32_t c = 0;
int32_t d = -1;
printf("%d + %d > 0 ? %s\r\n", c, d, c+d>0 ? "true" : "false");
//0 + -1 > 0 ? false
Now change 0 from signed to unsigned-
printf("%d + %d > 0u ? %s\r\n", c, d, c+d>0u ? "true" : "false");
//0 + -1 > 0u ? true
And so on.
In addition to getting in a habit of using the uintN_t/intN_t as already mentioned (which also makes you think about what values you are trying to store), you can also break down problems into simpler/smaller pieces that are easier to read and understand. The compiler could care less, and will mostly end up compiling to the same code anyway. The first example of doing that was to compute the elapsed time as a separate expression- you then know that the result is always a valid time, and you can move on the next problem.
>the compiler is flawed somewhere
Its always a waste of time to think the compiler is messing up somewhere/somehow. Its way more productive to start with the premise that you are not communicating with the compiler properly, or you are not following rules that the compiler is playing by. There are lots of rules, so the key is to simply know there are rules, and when something doesn't work as expected you can probably start by trying to figure out what rules apply.