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

CParser creates dead nodes #20

Open
joliebig opened this issue Apr 26, 2013 · 1 comment
Open

CParser creates dead nodes #20

joliebig opened this issue Apr 26, 2013 · 1 comment
Assignees
Labels

Comments

@joliebig
Copy link
Collaborator

Parsing the following code creates dead AST nodes:
void foo(
#ifdef A
int a
#else
double a
#endif
) { }

After parsing and pretty printing the result:

void foo

if definedEx(A)

(int a)

endif

if !definedEx(A)

(

if definedEx(A)

int <- Int specifier is dead!

endif

double a)

endif

{

}

@ghost ghost assigned ckaestne Apr 26, 2013
@ckaestne
Copy link
Owner

Florian Garbe has reported a similar problem which I have integrated as patch in the NoDeadNode branch.

The problem (at least this instance) comes from the strategyA heuristic in the parser. The heuristic creates an optional node and works fine by itself, but if another entry follows for which the heuristic doesn't work, it splits the parse result, creating two lists. The split result then contains the prior results twice and in one version some results may be empty.

I've submitted a patch 18fdcc0 that fixes this issue. Unfortunately it doesn't fix all problems of this kind and it slows down the parser significantly (needs more SAT checks), such that test rz1000.pi no longer parses in reasonable time.

As a consequence, I've not merged the patch into the master branch. It seems easier to live with dead nodes and eliminate them in a preprocessing step or ignore them in the analysis than slow down the parser for an (apparently only partial) solution.

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

No branches or pull requests

2 participants