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

Corrected keywords for intrinsic functions #3123

Merged
merged 16 commits into from
Jan 19, 2024
Merged

Conversation

Kishan-Ved
Copy link
Contributor

Fixes: #3076
Credit/Reference: #3105

@certik
Copy link
Contributor

certik commented Jan 15, 2024

Thanks!

Can you please add tests to ensure this change actually works?

Here is the design that we need to move to: #3090

@Kishan-Ved
Copy link
Contributor Author

Sure, I'll start working on it. Thanks!

integration_tests/intrinsics_110.f90 Outdated Show resolved Hide resolved
integration_tests/intrinsics_110.f90 Outdated Show resolved Hide resolved
integration_tests/intrinsics_111.f90 Outdated Show resolved Hide resolved
integration_tests/intrinsics_111.f90 Outdated Show resolved Hide resolved
integration_tests/intrinsics_112.f90 Outdated Show resolved Hide resolved
integration_tests/intrinsics_112.f90 Outdated Show resolved Hide resolved
integration_tests/intrinsics_108.f90 Outdated Show resolved Hide resolved
integration_tests/intrinsics_110.f90 Outdated Show resolved Hide resolved
@Kishan-Ved
Copy link
Contributor Author

I have corrected the names.

@certik
Copy link
Contributor

certik commented Jan 17, 2024

Excellent, I think that starts to look good!

@certik
Copy link
Contributor

certik commented Jan 18, 2024

I think this looks great. Can you please resolve the conflicts? Let's see if tests pass.

@Kishan-Ved
Copy link
Contributor Author

There seems to be some problem with the file: intrinsics_107
It was added by someone else, and hence it appeared as a conflict. I even got an error in it while running integration tests locally, and I fixed it. There are no errors integration test errors on my laptop, but the checks fail due to it.

@Kishan-Ved
Copy link
Contributor Author

For file intrinsics_107:
I got the output on my laptop as:

          32
          32
ERROR STOP 

so I changed 32 to 64. But now the Test on GitHub fails, error:

          32
          64
ERROR STOP 

@certik
Copy link
Contributor

certik commented Jan 18, 2024

Leave intrinsics_107 as it was (all tests pass at the CI as well as for me locally), just add your new file with a higher number.

@HarshitaKalani
Copy link
Contributor

Hey @Kishan-Ved
Please confirm if you followed the same steps
In you branch, after doing

git pull origin main

resolve the conflicts and then do

git clean -dfx
./build0.sh && ./build1.sh

And then update the test references and finally run the integration tests.

I think, you didn't do ./build0.sh && ./build1.sh and that's why: #3123 (comment) issue is coming up.

@Kishan-Ved
Copy link
Contributor Author

Hey @Kishan-Ved Please confirm if you followed the same steps In you branch, after doing

git pull origin main

resolve the conflicts and then do

git clean -dfx
./build0.sh && ./build1.sh

And then update the test references and finally run the integration tests.

I think, you didn't do ./build0.sh && ./build1.sh and that's why: #3123 (comment) issue is coming up.

Will these steps remove my changes?

@Kishan-Ved
Copy link
Contributor Author

Leave intrinsics_107 as it was (all tests pass at the CI as well as for me locally), just add your new file with a higher number.

Done.

@Kishan-Ved
Copy link
Contributor Author

Hey @Kishan-Ved Please confirm if you followed the same steps In you branch, after doing

git pull origin main

resolve the conflicts and then do

git clean -dfx
./build0.sh && ./build1.sh

And then update the test references and finally run the integration tests.
I think, you didn't do ./build0.sh && ./build1.sh and that's why: #3123 (comment) issue is coming up.

Will these steps remove my changes?

But I would like to know this though, how to fix such things without losing my changes?

END PROGRAM
Copy link
Contributor

Choose a reason for hiding this comment

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

remove this change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't change this, how do I remove it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Use

git checkout main -- integration_tests/intrinsics_107.f90
git commit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did this, but it says there's no such file found

Copy link
Contributor

Choose a reason for hiding this comment

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

Do git fetch origin first. Ensure origin points to https://github.com/lfortran/lfortran.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sir I tried that, I still get the error:
(lf) kishan@kishan-IdeaPad-3-15IIL05:~/Desktop/lfortran$ git checkout main -- integration_tests/intrinsics_107.f90 error: pathspec 'integration_tests/intrinsics_107.f90' did not match any file(s) known to git

Copy link
Contributor

Choose a reason for hiding this comment

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

It's right here: https://github.com/lfortran/lfortran/blob/main/integration_tests/intrinsics_107.f90, so you need to figure out why you don't have it in your local git. You might be in a wrong branch, wrong directory, didn't checkout the latest main, and so on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sir I figured this out 👍🏻, I got to learn a new thing today 🙂. Thank you.

@Kishan-Ved
Copy link
Contributor Author

There is a new file, intrinsics_108, should I change my file to a higher number?

@certik
Copy link
Contributor

certik commented Jan 18, 2024

There is a new file, intrinsics_108, should I change my file to a higher number?

Yes.

@certik
Copy link
Contributor

certik commented Jan 18, 2024

See here https://github.com/lcompilers/lpython/blob/30b5bfc41774833fb94ec0c2e1926ce33be10fdb/doc/src/rebasing.md how to use git for these kinds of rebasing and cleanup tasks.

@Kishan-Ved
Copy link
Contributor Author

I think we should keep x and y in hypot. (According to: https://gcc.gnu.org/onlinedocs/gfortran/HYPOT.html)

Copy link
Contributor

@HarshitaKalani HarshitaKalani left a comment

Choose a reason for hiding this comment

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

This looks good to me. I just left some comments for improvement.

@@ -0,0 +1,3 @@
program intrinsics_118
print *, hypot( x = 1.e0_4, y = 0.5e0_4 )
end program intrinsics_118
Copy link
Contributor

Choose a reason for hiding this comment

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

You can add error stop conditions in this file too.

Copy link
Contributor

Choose a reason for hiding this comment

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

@Kishan-Ved please submit a new PR with this improvement. I already set this one to merge.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok Sir. I'll do it.

if ( .not. product( array = x, mask = mask ) == 15 ) error stop
if ( .not. product( x, mask = mask ) == 15 ) error stop
if ( .not. product( x, mask ) == 15 ) error stop
end
Copy link
Contributor

Choose a reason for hiding this comment

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

We can follow this for other examples too to ensure that this approach works for all the cases - when we're putting some parameters as arguments directly (line 6) and while some are inserted as keywords(line 4 an line 5).

@certik certik enabled auto-merge (squash) January 19, 2024 06:15
@certik
Copy link
Contributor

certik commented Jan 19, 2024

Thanks for finishing the PR!

@certik certik merged commit 302c1ab into lfortran:main Jan 19, 2024
21 checks passed
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.

Add correct keywords for intrinsic functions
3 participants