graphitemaster / gmqcc

An Improved Quake C Compiler
Other
163 stars 29 forks source link

if(cond) + break; issue with -O3 #198

Closed terencehill closed 3 years ago

terencehill commented 3 years ago

This code doesn't compile with ./gmqcc -std=gmqcc -O3 mycode.qc -o out.dat && ./qcvm out.dat. with the error unreachable statement at the lines with comment. It does compile without the -03 flag.

void main() {
    while (1) // unreachable statement
    {
        if (1)
            break;
    }
}
void main() {
    float i = 0;
    while (1)
    {
        if (1)
        {
            if (1) // unreachable statement
                i = 1;
            break;
        }
    }
}
graphitemaster commented 3 years ago

Fixed by 71138cb