Opened 19 months ago

Closed 19 months ago

Last modified 14 months ago

#150 closed defect (fixed)

Incorrect Scoping when using continue

Reported by: Thierry Delisle Owned by: Thierry Delisle <tdelisle@…>
Priority: minor Component: cfa-cc
Version: 1.0 Keywords:
Cc:

Description

CFA code :

int main() {
	for(4) {
		if(true) continue;
		int num = 0;
	}
}

This should compile normally but results in an error claiming the continue jumps into a scope where num exists but was not initialized.

The reason is that the code is rewritten as :

int main(){
    for (4) {
        if (true) goto __loopContinue;
        int num = 0;
        __loopContinue: __attribute__ ((unused));
    }
}

It should probably be :

int main(){
    for (4) {
        {
            if (true) goto __loopContinue;
            int num = 0;
        }
        __loopContinue: __attribute__ ((unused));
    }
}

Change History (2)

comment:1 Changed 19 months ago by Thierry Delisle <tdelisle@…>

Owner: set to Thierry Delisle <tdelisle@…>
Resolution: fixed
Status: newclosed

In 397c101:

Fix bug where 'continue' would incorrectly claim to skip initialization Fixes #150?

comment:2 Changed 14 months ago by Thierry Delisle <tdelisle@…>

In 397c101:

Fix bug where 'continue' would incorrectly claim to skip initialization Fixes #150?

Note: See TracTickets for help on using tickets.