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

Strange (?) ReadGuard placement #39

Open
fingolfin opened this issue May 24, 2017 · 3 comments
Open

Strange (?) ReadGuard placement #39

fingolfin opened this issue May 24, 2017 · 3 comments

Comments

@fingolfin
Copy link
Member

I am seeing some compiler warnings for some code mangled by ward. Specifically, ward turns this code:

  else {
    ErrorQuit( "usage: DownEnv( [ <depth> ] )", 0L, 0L );
    return 0;
  }

into this:

  else {
    {
    ReadGuard(args);
#line 978 "../../src/gap.c"
    ErrorQuit( "usage: DownEnv( [ <depth> ] )", 0L, 0L );
    }
#line 979 "../../src/gap.c"
    return ReadGuard(args), 0;
  }
}

The warning I get is this:

../../src/gap.c:979:12: warning: incompatible integer to pointer conversion returning 'int' from a function with result type 'Obj' (aka 'unsigned long long **') [-Wint-conversion]
    return ReadGuard(args), 0;
           ^~~~~~~~~~~~~~~~~~

As it is, I am confused: Why does ward insert ReadGuard(args) here at all, and why twice?

Is this a bug (resp. a case of ward being too eager), or am I missing something here?

@fingolfin
Copy link
Member Author

@rbehrends any idea about this?

@fingolfin
Copy link
Member Author

@rbehrends ping?

@fingolfin
Copy link
Member Author

Quoting @rbehrends from Slack:

This is extremely odd. I’m not sure why the C compiler emits a warning here. The insertion of the ReadGuard() is probably related to something that I’ve been looking into recently.
And which also leads to the creation of superfluous guards elsewhere.
The nodes in the program graph are traversed in the order they are created for purposes of autogenerating guards, but do not necessarily reflect the control flow in a function.

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

No branches or pull requests

1 participant