https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120321

--- Comment #1 from Wentao Zhang <wentaoz5 at illinois dot edu> ---
Another example that shows the effect can propagate from the "while(1)" line 
to adjacent no-code, reduced from
https://sources.debian.org/src/lzo2/2.10-2/src/lzo1x_d.ch/#L98
where "NEED_IP" is expanded to "(void) 0".

int g;
int one = 1;

void foo() {
    int x = 0;

    while(1) { // using variable "one" as predicate changes the behavior
        // g++; // uncommenting this line changes the behavior
        (void) 0; // <= line coverage refers to C1 - C2
        g++; // C1

        x++;
        if (x >= 7)
            break; // C2

        g++; // C1 - C2
    }
}

int main(void) {
    for (int i = 0; i < 11; i++)
        foo();
}

Reply via email to