mpich icon indicating copy to clipboard operation
mpich copied to clipboard

Warnings squash for icx compiler

Open abrooks98 opened this issue 3 years ago • 3 comments

Pull Request Description

Starting with oneAPI version 2022.0.1, new warnings are showing up when using icx, for which this PR addresses:

adio/common/p2p_aggregation.c:150:9: warning: variable 'totalAmountDataReceived' set but not used [-Wunused-but-set-variable]
    int totalAmountDataReceived = 0;
        ^
mpiexec/pmiserv_utils.c:252:22: warning: variable 'total_filler_processes' set but not used [-Wunused-but-set-variable]
    int proxy_count, total_filler_processes, total_core_count;
                     ^
src/mpi/datatype/datatype_impl.c:27:46: warning: performing pointer subtraction with a null pointer has undefined behavior [-Wnull-pointer-subtraction]
    *address = (MPI_Aint) ((char *) location - (char *) MPI_BOTTOM);
                                             ^ ~~~~~~~~~~~~~~~~~~~

Author Checklist

  • [x] Provide Description Particularly focus on why, not what. Reference background, issues, test failures, xfail entries, etc.
  • [x] Commits Follow Good Practice Commits are self-contained and do not do two things at once. Commit message is of the form: module: short description Commit message explains what's in the commit.
  • [ ] Passes All Tests Whitespace checker. Warnings test. Additional tests via comments.
  • [x] Contribution Agreement For non-Argonne authors, check contribution agreement. If necessary, request an explicit comment from your companies PR approval manager.

abrooks98 avatar Feb 22 '22 16:02 abrooks98

@hzhou there is an additional warning showing up for which I am unsure how to address:

src/mpi/datatype/datatype_impl.c:27:46: warning: performing pointer subtraction with a null pointer has undefined behavior [-Wnull-pointer-subtraction]
    *address = (MPI_Aint) ((char *) location - (char *) MPI_BOTTOM);
                                             ^ ~~~~~~~~~~~~~~~~~~~

Based on the comments to the corresponding code, the intention is to subtract a null pointer from location, which this warning is complaining about.

abrooks98 avatar Feb 22 '22 16:02 abrooks98

@hzhou there is an additional warning showing up for which I am unsure how to address:

src/mpi/datatype/datatype_impl.c:27:46: warning: performing pointer subtraction with a null pointer has undefined behavior [-Wnull-pointer-subtraction]
    *address = (MPI_Aint) ((char *) location - (char *) MPI_BOTTOM);
                                             ^ ~~~~~~~~~~~~~~~~~~~

Based on the comments to the corresponding code, the intention is to subtract a null pointer from location, which this warning is complaining about.

This is strictly standard-compliant and we are as explicit in our intention with the cast as we can. So IMO it's the compiler's fault to warn about. You can try the direct casting branch to see if the compiler like it better.

hzhou avatar Feb 22 '22 17:02 hzhou

This is strictly standard-compliant and we are as explicit in our intention with the cast as we can. So IMO it's the compiler's fault to warn about. You can try the direct casting branch to see if the compiler like it better.

Taking the direct casting branch for icx seems to resolve the warning on our side. I've added a commit for this, but let me know if you had something else in mind regarding how to do this. I'll also reach out to someone on the compiler team to discuss standard compliance regarding this warning

abrooks98 avatar Feb 24 '22 20:02 abrooks98