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

There's no general solution for the problem of repeatedly printing the same error #341

Closed
sethfowler opened this issue Mar 1, 2017 · 3 comments
Labels
enhancement This topic discusses an improvement to existing compiler code.

Comments

@sethfowler
Copy link
Contributor

For a variety of reasons (fixed-point algorithms, compiler transformations that duplicate portions of the IR tree, utility code being invoke from multiple passes) we can end up printing the same error message many times. Loop unrolling is a place where this is biting us in a particularly nasty way.

There are ad hoc solutions for this problem at various places in the code; one example is the usage of iterCounter here:

https://github.com/p4lang/p4c/blob/master/frontends/p4-14/typecheck.cpp#L291

It would be good to have a more general solution to this problem. We should think about what the requirements are.

@mihaibudiu
Copy link
Contributor

The simplest solution is to bail out from compiling. This works for errors, not for warnings.
A PassManager will stop after the first pass that signals an error by default. So will a RepeatedPass.
So the only issue is within a pass, which should be tractable.

(I am not aware of any loop unrolling code that is being run in the front-end.)

@sethfowler
Copy link
Contributor Author

Bailing out would work for errors, that's true. It's nice to report as many errors as possible, though, to reduce the number of edit-compile cycles a P4 developer has to go through.

@mihaibudiu mihaibudiu added the enhancement This topic discusses an improvement to existing compiler code. label Apr 7, 2017
@mihaibudiu
Copy link
Contributor

I will close this issue because it is too general. An example would be more useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This topic discusses an improvement to existing compiler code.
Projects
None yet
Development

No branches or pull requests

2 participants