Problem with modulo (%) and reset

I can get this one to hang:

ldiv_t n1000;
unsigned long m = 0;

void setup() {
}

void loop() {
  n1000 = ldiv(m++,1000000L);  // This hangs Arduino while pressing reset
}

You code may not hang because if nothing is changing, the compiler may optimize something away. The same was also problem for "my minimal code with modulo" when nothing was changing.