> while (something) { i=i+a[j]; }>> Or, slightly less bizarre, j might be bound to an input register> of an external device. In this case we don't even need to assign> to a potentially conflicting extern to get j non-invariant.

As mentioned by the moderator, j should be defined as volatile or
const volatile.

However, even if j is defined volatile or const volatile, not all
compilers implement the standard correctly, and you may want to
review the code generated by your compiler, particularly when using
the optimizer. Of eighteen commercially available compilers that I
evaluated, sixteen (90%) of these compilers hoisted references to
volatile and/or const volatile objects out of a loop.