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

Fix #2399 - duplication error with __v1model_version in v1model #2398

Merged
merged 1 commit into from
May 27, 2020

Conversation

dush-t
Copy link
Contributor

@dush-t dush-t commented May 27, 2020

When you try to compile using p4c-bm2-ss --p4v 16 "foo.p4" -o "bar.json",
where foo.p4 includes v1model.p4, it throws this error -

/usr/local/share/p4c/p4include/v1model.p4(72): [--Werror=duplicate] error: __v1model_version duplicates __v1model_version.
const bit<32> __v1model_version = 20180101;
              ^^^^^^^^^^^^^^^^^
/usr/local/share/p4c/p4include/v1model.p4(66)
const bit<32> __v1model_version = 20180101;
              ^^^^^^^^^^^^^^^^^

This because __v1model_version is declared twice. This PR fixes that by, well, removing a line. Felt it would be better to just create a PR than creating an issue. This fixes issue #2399

@hesingh
Copy link
Contributor

hesingh commented May 27, 2020

You don't need to include the json filename in double-quotes. I am using a p4c as latest as from yesterday and I cannot reproduce the issue. The P4 program I have used also includes v1model.p4.
See my test log below.

hemant@ubuntu:/tmp/p4c/build$ ./p4c-bm2-ss --std p4-16 ../testdata/p4_16_samples/v1model-special-ops-bmv2.p4 -o tmp.json
hemant@ubuntu:/tmp/p4c/build$ ./p4c-bm2-ss --version
././p4c-bm2-ss
Version 1.2.0 (SHA: 1659a2a1 BUILD: DEBUG)
hemant@ubuntu:/tmp/p4c/build$ ./p4c-bm2-ss --std p4-16 ../testdata/p4_16_samples/v1model-special-ops-bmv2.p4 -o "tmp.json"
hemant@ubuntu:/tmp/p4c/build$ 
hemant@ubuntu:/tmp/p4c/build$ ./p4c-bm2-ss --p4v 16 ../testdata/p4_16_samples/v1model-special-ops-bmv2.p4 -o "tmp.json"
hemant@ubuntu:/tmp/p4c/build$ 

@dush-t
Copy link
Contributor Author

dush-t commented May 27, 2020

Update your p4 compiler again. The commit that introduced this issue was from 16 hours ago. Check then.

@dush-t dush-t changed the title Fix duplication error with __v1model_version in v1model Fix #2399 - duplication error with __v1model_version in v1model May 27, 2020
@hesingh
Copy link
Contributor

hesingh commented May 27, 2020

After updating my p4c to latest, I can reproduce the issue, thanks.

@hesingh
Copy link
Contributor

hesingh commented May 27, 2020

This checkin has caused the issue:

93f4598#diff-68d536ca6ecb3bfe9ddbb6d67f5a6207

Please wait for @mbudiu-vmw to review this PR code changes.

Copy link
Contributor

@ChrisDodd ChrisDodd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like an auto-merge snafu

@mihaibudiu
Copy link
Contributor

We should make sure we keep the one in the middle.

@dush-t
Copy link
Contributor Author

dush-t commented May 27, 2020

After fixing this, please also update the p4c docker image, since it also contains this bug.

@mihaibudiu mihaibudiu merged commit 7557897 into p4lang:master May 27, 2020
@mihaibudiu
Copy link
Contributor

The docker image will be updated automatically after a while.

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

Successfully merging this pull request may close these issues.

4 participants