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:
205 bytes
|
| Line | |
|---|
| 1 | #include <assert.h>
|
|---|
| 2 | typedef struct teststr {
|
|---|
| 3 | int member;
|
|---|
| 4 | } testStr;
|
|---|
| 5 |
|
|---|
| 6 | int main() {
|
|---|
| 7 | int a = 0;
|
|---|
| 8 | for (int i = 0; i < 10; i++) {
|
|---|
| 9 | testStr i;
|
|---|
| 10 | i.member = 7;
|
|---|
| 11 | a += i.member;
|
|---|
| 12 | }
|
|---|
| 13 | assert(a==70);
|
|---|
| 14 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.