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

Issue 192 revisited -- still broken in interactive mode. #193

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

Issue 192 revisited -- still broken in interactive mode. #193

GoogleCodeExporter opened this issue Oct 14, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

r605 was intended to address issue 192, but does not do so for interactive mode.


What steps will reproduce the problem?
1. Enter the following at the command line / within picoc interactive mode:
Marks-MacBook-Air:picoc-608 heilpern$ ./picoc -i
starting picoc v2.2 beta r608
picoc> #include <stdio.h>
picoc> 
     > void printArray(void) {
     > #define SIZE 10
     >     int array[SIZE] = {5, 4, 3, 9, 1, 8, 6, 7, 5, 2};
     >     printf("4: %d\n", array[4]);
     > }
picoc> printArray();
Segmentation fault: 11



What is the expected output? What do you see instead?
Expected output is "4: 1" rather than the crash/segfault.

I've verified that running the test case for this change does in fact work; the 
crash only occurs from interactive mode.



What version of the product are you using? On what operating system?
r608 / OS X Mavericks


Original issue reported on code.google.com by [email protected] on 3 Mar 2014 at 9:31

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

This crash happens at the same line of code as bug #190 and for the same 
reason: pc->InteractiveCurrentLine is null. It's another re-entrancy issue. 
This time, while executing printArray(), picoc is re-evaluating the #define. 
This, of course, is not how a compiler would handle a preprocessor statement. 

It's also bad style to put a #define inside a function, but it's legal C.

Original comment by [email protected] on 5 Aug 2015 at 2:42

@GoogleCodeExporter
Copy link
Author

Although this crash is similar to bug #190, the fix that worked for 190 
(preserving the lexer state) needs to be applied at a different line of code. 
I'm not sure exactly where, but it's somewhere in the call stack for the crash.

Original comment by [email protected] on 17 Aug 2015 at 3:11

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