Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable scope not always respected #201

Open
GoogleCodeExporter opened this issue Oct 14, 2015 · 0 comments
Open

Variable scope not always respected #201

GoogleCodeExporter opened this issue Oct 14, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?

picoc> while(1) {
     >   int e = getchar();
     >   if(e == 0x20) break;
     > }
f
d
t

picoc> int e;
             ^
:5: 'e' is already defined

What is the expected output? What do you see instead?
Variable "e" should have no meaning outside of the while() block, however, it 
is still defined when execution continues past the block.


What version of the product are you using? On what operating system?
This happens both on v2.1 and on r608, both on x86-64 Linux 3.14 with GCC 
4.8.2, and on a platform with SH4 CPU I'm porting PicoC to (with great 
success), and for which I cross-compile using GCC 4.8.2 too.


Please provide any additional information below.
This also appears to happen with if blocks, and probably with for blocks too...

picoc> if(1) {
     >   int a = 6;
     > }
     > int a;
             ^
:4: 'a' is already defined
picoc>

Original issue reported on code.google.com by [email protected] on 30 Jan 2015 at 6:43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant