> This sounds like a compiler bug to me. A statement > of the form: > > for (i=0; i < 12; i++) { > <code that doesn't change "i"> > } > > should never generate an infinite loop. As seen in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54136#c5 this is hiding something important: > double cam_xyz[4][3]; The code tries to access it like this: > cam_xyz[0][j] = table[i].trans[j] / 10000.0; And this is the problem with your code. It just does something undefined and happens to get some defined behavior. This is why GCC developers marked this problem as invalid and told that the code is broken [1]. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54136#c5