Skip to content

Conversation

@jsquyres
Copy link
Member

There were many compiler warnings, making it difficult to read if
there were real issues that needed to be addressed.

Signed-off-by: Jeff Squyres jsquyres@cisco.com

@jsquyres jsquyres force-pushed the pr/fix-test-warnings branch from 5212395 to 0e76227 Compare April 24, 2021 17:23
@open-mpi open-mpi deleted a comment from ibm-ompi Apr 26, 2021
@open-mpi open-mpi deleted a comment from ibm-ompi Apr 26, 2021
@open-mpi open-mpi deleted a comment from ibm-ompi Apr 26, 2021
@open-mpi open-mpi deleted a comment from ibm-ompi Apr 26, 2021
@jjhursey
Copy link
Member

IBM CI had a bad weekend (sorry about that). We should be all good now.
bot:ibm:pgi:retest
bot:ibm:xl:retest

{ NULL, "MPI_OP_NULL", MPI_OP_NULL }
};
static int do_ops[12] = { -1, }; /* index of the ops to do. Size +1 larger than the array_of_ops */
static int global_do_ops[12] = { -1, }; /* index of the ops to do. Size +1 larger than the array_of_ops */
Copy link
Member

Choose a reason for hiding this comment

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

I doubt it is necessary, the shadowing is done in purpose.

Copy link
Member Author

Choose a reason for hiding this comment

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

The shadowing creates a bunch of warnings, such as:

1122 reduce_local.c: In function ‘build_do_ops’:
1123 reduce_local.c:84:34: warning: declaration of ‘do_ops’ shadows a global decla\
     ration [-Wshadow]
1124  build_do_ops( char* optarg, int* do_ops)
1125                              ~~~~~^~~~~~

Copy link
Member

Choose a reason for hiding this comment

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

I understand what the warning is but I said I do this on purpose. By default all functions use the global variable until I need to specialize their behavior, in which case I add a param shadowing the global variable.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not a huge fan of that paradigm, as I think it's pretty easy for developers to miss and or get wrong. I certainly wouldn't want any of the developers in my org to write code like that. That said, if we are going to intentionally shadow variables, can we at least document that we're doing so intentionally? I still think it is bad form, and that we should not remove the general compiler warning, so we'll have to figure out how to ignore the warning in this file), but we at least need to tell people it was intentional.

}
for (i = 0; 0 != arr[i][0]; i++) {
if( (displ >= arr[i][1]) && (displ <= (arr[i][1] + arr[i][0])) ) {
if( (displ >= (ptrdiff_t) arr[i][1]) &&
Copy link
Member

Choose a reason for hiding this comment

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

displ is a ptrdiff_t already because of a compiler complaint, (because it is computed as a difference between two pointers, while in fact is the displacement of a field in a struct).

Copy link
Member Author

Choose a reason for hiding this comment

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

Here's the compiler warnings it generated without updating the RHS to be (ptrdiff_t):

1024 unpack_ooo.c: In function ‘testcase’:
1025 unpack_ooo.c:154:32: warning: comparison of integer expressions of different \
     signedness: ‘ptrdiff_t’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int\
     ’} [-Wsign-compare]
1026                      if( (displ >= arr[i][1]) && (displ <= (arr[i][1] + arr[i\
     ][0])) ) {
1027                                 ^~
1028 unpack_ooo.c:154:56: warning: comparison of integer expressions of different \
     signedness: ‘ptrdiff_t’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int\
     ’} [-Wsign-compare]
1029                      if( (displ >= arr[i][1]) && (displ <= (arr[i][1] + arr[i\
     ][0])) ) {
1030                                                         ^~

I don't have an opinion on this one; do you prefer a different fix?

Copy link
Member

Choose a reason for hiding this comment

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

Based on a machine understanding of a piece of code. I don't really care.

@jsquyres jsquyres force-pushed the pr/fix-test-warnings branch from 0e76227 to a2b3fa8 Compare April 29, 2021 01:18
@gpaulsen
Copy link
Member

gpaulsen commented May 21, 2021

@jsquyres Can you please rebase? This may be important.

@jsquyres jsquyres force-pushed the pr/fix-test-warnings branch from a2b3fa8 to c2c0e2d Compare June 2, 2021 13:23
@gpaulsen
Copy link
Member

bot:retest
/azp run
bot:ibm:retest

@gpaulsen
Copy link
Member

bot:ibm:retest

@jjhursey
Copy link
Member

jjhursey commented Aug 4, 2022

Any reason to hold this PR any longer? (other than it need to be rebased)

@gpaulsen
Copy link
Member

I rebased on tip of main(no code change).

@jsquyres
Copy link
Member Author

If that 3rd commit passes CI properly, you'll squash it appropriately, right? (minor pet peeve: make a commit on a PR and then make a later commit on the same PR to fix the earlier commit)

Copy link
Member

@bwbarrett bwbarrett left a comment

Choose a reason for hiding this comment

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

What's the warning? The non-sized version is supposed to handle multiple sizes without warning, so if we're emitting warnings here, that's an issue we shouldn't gloss over with this particular patch.

@gpaulsen
Copy link
Member

mellanox CI failed that it couldn't find a definition for the non-sized versions of these, and I searched around and couldn't find those definitions either, so I created the 3rd commit.
Why the other CIs didn't fail, I'm not sure.
@bwbarrett thoughts?

@gpaulsen
Copy link
Member

I git bisected opal/include/opal/sys/atomic_stdc.h and couldn't find a definition for opal_atomic_compare_exchange_strong anywhere in the past.

@bwbarrett
Copy link
Member

bot:aws:retest

jsquyres and others added 3 commits September 29, 2022 08:26
There were many compiler warnings, making it difficult to read if
there were real issues that needed to be addressed.

Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
Trivial updates to make all the output appear on stderr (vs. just some
of it on stderr and other parts of it on stdout).

Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
Fixing 6 calls that I may have incorrectly addressed in the previous
commit when I rebased to latest main.

Signed-off-by: Geoffrey Paulsen <gpaulsen@us.ibm.com>
@jsquyres jsquyres force-pushed the pr/fix-test-warnings branch from 2f6c7a6 to f76b68a Compare September 29, 2022 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants