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

The declaration of a structure is moved to a wrong position. #85

Open
h-murai opened this issue Sep 5, 2018 · 1 comment
Open

The declaration of a structure is moved to a wrong position. #85

h-murai opened this issue Sep 5, 2018 · 1 comment

Comments

@h-murai
Copy link
Collaborator

h-murai commented Sep 5, 2018

The order of declarations are changed by C_Front if there is a linemarker directive in the function. As a result, the backend compiler causes an error.

Original source code:

void f(){
  struct timeval
  {
    int tv_sec;
  };

  struct itimerval {
    struct timeval it_interval;
  };

# 3 "himeno.c"
  struct timeval tm;
}

Translated code:

void f()
{
struct itimerval {
struct timeval it_interval;
};
# 3 "himeno.c" 
{
struct timeval {
int tv_sec;
};
struct timeval tm;
}
}
@h-murai h-murai self-assigned this Sep 5, 2018
@h-murai h-murai changed the title Wrong order of declarations if there is a linemarker The declaration of a structure is moved to a wrong position. Sep 6, 2018
@h-murai
Copy link
Collaborator Author

h-murai commented Sep 6, 2018

Regardless of whether linemarkers are used, this error occurs.

Original source code:

float x;

void f(){
  struct timeval {
  };

  struct xxx {
    struct timeval yyy;
  };

  x = 1;
  
  struct timeval tm;
}

Translated code:

float x;
void f()
{
struct xxx {
struct timeval yyy;
};
x = (1);
{
struct timeval {
};
struct timeval tm;
}
}

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