Skip to content

Conversation

@ursg
Copy link

@ursg ursg commented May 4, 2023

For communication of empty (zero velocity blocks) Vlasiator cells, this was trying to do an AllGather of some empty arrays, but the actual Allgatherv call tried to acess &(temp_result[0]), which is technically a nullpointer dereference.

This probably wasn't causing any actual issue (because every sane compiler would optimize that away anyway), but was reported by GCC12's undefined behaviour sanitizer.

But anyway, if total_send_count is zero in the AllGather, the whole second stage of the communication can anyway be skipped, so that's how this is fixed now.

Discovered by GCC12's undefined behaviour sanitizer.
@iljah
Copy link

iljah commented May 4, 2023

As commented above that code, this can also be fixed by using temp_result.data() instead of &(temp_result[0]) and by now c++11 is old enough for that :)
But not even trying to send anything if there's nothing to send is probably even better...

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.

2 participants