Incorrect OpenGL(GLSL) compiler behavior on nested loops

Sometimes when using a global int for loop break control in nested loops, compiler will wrongly apply the global int limit to the inside loop, which may make the loops never exit even they are intended to exit. For example, here is a simple fragment shader:

#version 330 compatibility

layout(location = 0) out vec4 fragColor;

void main() {
    float a = 0.0;
    int i = 0;
    while(true) {
        bool hit = false;
        while(i < 200) {
            i++;
            hit = !hit;
            if (hit) {
                break;
            }
        }
        if (!hit) {
            a = 1.0;
            break;
        }
    }
    fragColor = vec4(a);
}

This loop is designed to run at most 200 times controled by a global int i in main function. After the inside loop have run 200 times, it will not run anymore, and leaving hit be false to break the outside loop.
After attaching it to a program and linking it, in binary it will be like this:

OPTION NV_internal;
OPTION NV_bindless_texture;
TEMP R0;
TEMP T;
TEMP RC;
SHORT TEMP HC;
OUTPUT result_color0 = result.color;
MOV.F R0.x, {0, 0, 0, 0};
REP.S ;
SEQ.U.CC HC.x, {1, 0, 0, 0}, {0, 0, 0, 0};
BRK (NE.x);
MOV.U R0.y, {0, 0, 0, 0}.x;
REP.S {200, 0, 0, 0};
SEQ.U R0.z, R0.y, {0, 0, 0, 0}.x;
MOV.U.CC RC.x, -R0.z;
MOV.U R0.y, -R0.z;
IF NE.x;
MOV.U.CC RC.x, {1, 0, 0, 0};
BRK (NE.x);
ENDIF;
ENDREP;
SEQ.U.CC HC.x, R0.y, {0, 0, 0, 0};
IF NE.x;
MOV.U.CC RC.x, {1, 0, 0, 0};
MOV.F R0.x, {1, 0, 0, 0};
BRK (NE.x);
ENDIF;
ENDREP;
MOV.F result_color0, R0.x;
END

In the binary assembly, the global limit control i is removed, instead, the inside loop will always run no matter how many times it have run, causing the outside loop never ends.