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

bogus 'yyaccept' in '-c' mode #46

Closed
skvadrik opened this issue Jun 4, 2015 · 2 comments

Comments

@skvadrik
Copy link
Owner

commented Jun 4, 2015

Consider the following re2c source (1.re):

/*!re2c
    <c1> "b" {}
    <c1> "bbb" {}

    <c2> "a" {}
    <c2> "aaa" {}
    <c2> "aaaaa" {}
*/

Build and grep all 'yyaccept' and 'yyc_' (condition borders):

$ re2c -c 1.re | grep "yyaccept\|yyc_"
        unsigned int yyaccept = 0;
        case yycc1: goto yyc_c1;
        case yycc2: goto yyc_c2;
yyc_c1:
        yyaccept = 0;
yyc_c2:
        if (yyaccept == 0) {
        yyaccept = 0;
        yyaccept = 1;

What do we have here? Condition 'c1' assigns 'yyaccept' a value but never uses it (because it doesn't need it).

Reproduced with 0.13.6, 0.14.2 and HEAD.

Original comment by: skvadrik

@skvadrik

This comment has been minimized.

Copy link
Owner Author

commented Jun 4, 2015

  • status: accepted --> closed-fixed

Original comment by: skvadrik

@skvadrik

This comment has been minimized.

Copy link
Owner Author

commented Jun 4, 2015

Fixed. See this commit.

This fix also affects most of the PHP scanners (they actually revealed the bug). See the changed tests.

Original comment by: skvadrik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.