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

Define conversions explicitly, and use more rigorous flags in the CI #703

Merged

Conversation

weslleyspereira
Copy link
Collaborator

PR #702 fixed a problem that could be avoided by using more strict flags in the CI. This PR:

  • Applies explicit type casts all over the library (not including tests for now).
  • Use more strict flags in the CI.

I still couldn't use -Werror=lto-type-mismatch, as suggested in #702 (comment), because the tests still have type mismatch and/or implicit type casts.

langou
langou previously approved these changes Aug 10, 2022
Copy link
Contributor

@langou langou left a comment

Choose a reason for hiding this comment

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

I like these explicit casts, this makes the code cleaner in my opinion.

@weslleyspereira
Copy link
Collaborator Author

The compiler will do the correct cast in most (all) cases. The point is separate compiler warnings that can really help identify a bug from the type casts that make sense. After those changes, it is easier to use -Wall and find true issues in the code.

@mjacobse
Copy link
Contributor

mjacobse commented Aug 10, 2022

Sorry for the work I caused with my suggestion 😄

I also think the explicit conversions are a good improvement. I am not quite clear on how these changes relate to LTO though, to me it seems like it does not really belong to this commit? I'm not sure how much value there is in enabling LTO in the CI without -Werror=lto-type-mismatch in the FFLAGS. But I suppose it does not really hurt to enable it here already (though it does considerably increase link-time).

The additional errors from -Werror=lto-type-mismatch that I unfortunately missed in #702 seem to be exclusively in the testing code for me. This commit fixes them for me: mjacobse@35dd277 (edit: actually, more stuff seems to come up when compiling CBLAS too...)
After rereading your message I understand that you have already tracked these down though @weslleyspereira ? Do you intend to create another pull request for those?

Personally I am also a bit cautious with the general -Werror for all warnings instead of a specific one. A compiler update that introduces a new warning into a default set may easily break builds that way. But I suppose in the CI that might even be a good thing?

@weslleyspereira
Copy link
Collaborator Author

Sorry for the work I caused with my suggestion smile

No problem at all. This is time we spend now to avoid problems in future.

I also think the explicit conversions are a good improvement. I am not quite clear on how these changes relate to LTO though, to me it seems like it does not really belong to this commit? I'm not sure how much value there is in enabling LTO in the CI without -Werror=lto-type-mismatch in the FFLAGS. But I suppose it does not really hurt to enable it here already (though it does considerably increase link-time).

When you do not use -Werror=lto-type-mismatch but -Wall are active, you still obtain warnings [-Wlto-type-mismatch]. This PR fixes all warnings [-Wconversion] I could find (excluding the ones in the test suite. I forgot to say that. It is helpful to have those warnings.

The additional errors from -Werror=lto-type-mismatch that I unfortunately missed in #702 seem to be exclusively in the testing code for me. This commit fixes them for me: mjacobse@35dd277 After rereading your message I understand that you have already tracked these down though @weslleyspereira ? Do you intend to create another pull request for those?

Great! Can I merge your commit and add it to this branch? Or maybe you want to propose a PR. Thanks.

No, I have just tracked the issues related to [-Wconversion]. I am sorry my initial message was not complete.

Personally I am also a bit cautious with the general -Werror for all warnings instead of a specific one. A compiler update that introduces a new warning into a default set may easily break builds that way. But I suppose in the CI that might even be a good thing?

Yeah... -Werror is too much, and may cause problems Thanks. It was just for my testing purposes. I will come back to -Wall and then we can promote some warnings to errors in the CI. It is a good thing that the CI is more strict in my view.

@mjacobse
Copy link
Contributor

Sure, here is the PR: #706

The CBLAS (and probably also LAPACKE) stuff will need more work I'm afraid. On a first glance it seems like the recent BLAS_FORTRAN_STRLEN_END addition might have to be sprinkled all over the CBLAS test code too. But maybe there are better solutions.

@codecov
Copy link

codecov bot commented Aug 10, 2022

Codecov Report

Merging #703 (636150e) into master (cb8d38c) will not change coverage.
The diff coverage is 0.00%.

❗ Current head 636150e differs from pull request most recent head 9f65664. Consider uploading reports for the commit 9f65664 to get more accurate results

@@           Coverage Diff           @@
##           master     #703   +/-   ##
=======================================
  Coverage    0.00%    0.00%           
=======================================
  Files        1894     1894           
  Lines      184078   184078           
=======================================
  Misses     184078   184078           
Impacted Files Coverage Δ
SRC/cgebak.f 0.00% <0.00%> (ø)
SRC/cgees.f 0.00% <0.00%> (ø)
SRC/cgeesx.f 0.00% <0.00%> (ø)
SRC/cgejsv.f 0.00% <0.00%> (ø)
SRC/cggbak.f 0.00% <0.00%> (ø)
SRC/cggbal.f 0.00% <0.00%> (ø)
SRC/cggglm.f 0.00% <0.00%> (ø)
SRC/cgghd3.f 0.00% <0.00%> (ø)
SRC/cgglse.f 0.00% <0.00%> (ø)
SRC/cggqrf.f 0.00% <0.00%> (ø)
... and 57 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@weslleyspereira
Copy link
Collaborator Author

Notes:

Commit e203d67 has:

-Wlto-type-mismatch: 13
-Wconversion: 54
-Wsurprising: 2
-Winteger-division: 4
-Wintrinsic-shadow: 1
-Wunused-dummy-argument: 173
-Wunused-variable: 26
-Wunused-label: 2

@weslleyspereira
Copy link
Collaborator Author

Last commits:

  • I removed all warnings related to Implicit conversion on the Fortran code, and activate the flag -Werror=conversion in the CI
  • The CI using Makefile uses Link Time Optimization (LTO) so we can tests the library in this configuration.

@langou langou merged commit 83c7e0d into Reference-LAPACK:master Oct 6, 2022
@julielangou julielangou added this to the LAPACK 3.11.0 milestone Nov 12, 2022
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