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

Incorrect reference of enum specifier in lazy instantiated variable of the test #600

Closed
IDKWNTCMF opened this issue Jul 13, 2023 · 0 comments · Fixed by #602
Closed

Incorrect reference of enum specifier in lazy instantiated variable of the test #600

IDKWNTCMF opened this issue Jul 13, 2023 · 0 comments · Fixed by #602
Labels
bug Something isn't working

Comments

@IDKWNTCMF
Copy link
Collaborator

Description
If project contains enum with name given by typedef:

typedef enum {
    EVEN,
    ODD
} Parity;

And structs, something like:

struct WrapperStruct {
    Parity p;
};

struct PointerStruct {
    struct WrapperStruct* wrapperStruct;
};

int parityToInt(struct PointerStruct* s) {
    struct WrapperStruct* w = s->wrapperStruct; 
    Parity parity = w->p;
    if (parity == EVEN) {
        return 0;
    }
    return 1;
}

Then generated test can contain lazy instantiated variable:

struct WrapperStruct utbotInnerVar1 = {
    .p = (enum Parity)(507720632)
};

As a result the test cannot be run.

To Reproduce
Steps to reproduce the behavior:

  1. Add example from description in your project.
  2. Generate for function ParityToInt.
  3. See that generated test looks like example above (constant may be different).

Expected behavior
Test is supposed to be generated and executed.

Actual behavior
Test cannot be executed.

Visual proofs (screenshots, logs)

error: typedef 'Parity' cannot be referenced with a enum specifier
        .p = (enum Parity)(507720632)
@IDKWNTCMF IDKWNTCMF added the bug Something isn't working label Jul 13, 2023
@kichunya kichunya linked a pull request Jul 13, 2023 that will close this issue
IDKWNTCMF added a commit that referenced this issue Jul 18, 2023
* Resolve issue with unnecessary enum specifier
@github-project-automation github-project-automation bot moved this from Todo to Done in UTBot C/C++ Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant