source: CIVL/examples/languageFeatures/shadow1.c

main
Last change on this file was f0aaefb, checked in by Stephen Siegel <siegel@…>, 3 years ago

Fixed bug in which a variable shadowing a for loop variable was not interpreted correctly. Two tests added to languageFeatures test: shadow1.c and shadow2.c. The side effect remove was attempting to simplify the loop body by removing what it thought was a redundant inner scope, but it was not redundant because a variable with same name as loop variable could be declared in the loop body and it is a separate variable.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5740 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 129 bytes
Line 
1#include <assert.h>
2int main() {
3 int a = 0;
4 for (int i = 0; i < 10; i++) {
5 int i = 7;
6 a += i;
7 }
8 assert(a==70);
9}
Note: See TracBrowser for help on using the repository browser.