-
Notifications
You must be signed in to change notification settings - Fork 38
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
Work around spurious "missing return statement" warnings for NVCC and Intel compilers #1102
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JaredCrean2 Thank you for looking into it! Sorry about the issue, we will fix the nvcc warnings in the near future (#272).
In the mean time, I tested the compiler version on godbolt, and every NVCC version prior to 11.5 and Intel (icc) prior to 2021.7 are susceptible.
To be a bit kinder to ourselves in the future, could you please try out the following patch:
--- a/src/details/ArborX_DetailsLegacy.hpp
+++ b/src/details/ArborX_DetailsLegacy.hpp
@@ -52,6 +52,12 @@ public:
expand(bounding_volume, Access::get(_primitives, i));
return value_type{bounding_volume, (index_type)i};
}
+#if (defined(KOKKOS_COMPILER_NVCC) && (KOKKOS_COMPILER_NVCC < 1150)) || \
+ (defined(KOKKOS_COMPILER_INTEL) && (KOKKOS_COMPILER_INTEL <= 2021))
+ // FIXME_NVCC, FIXME_INTEL: workaround for spurios "missing return
+ // statement at end of non-void function" warning
+ return value_type{};
+#endif
}
KOKKOS_FUNCTION
and see if it fixes the issue? I would prefer this way to clearly indicate when we can clean this up in the future, as well as to not affect the code for any other compilers.
Note: all Intel compilers 2021.* have 2021
as version.
Kokkos does it slightly different: https://github.com/kokkos/kokkos/blob/63f05204d0eaeec83e25f87eeb8025a188683f92/algorithms/src/std_algorithms/impl/Kokkos_UniqueCopy.hpp#L178-L181, by relying on |
The patch does fix the warnings. For the intel compiler, the details are:
And the warning is:
Although I can't get godbolt to reproduce it with a minimal example. The Intel classic compiler is deprecated in favor of the new Clang-based compiler, so may |
Here's the reproducer for Intel (classic, I'm not sure if you noticed I edited my patch to include Intel. |
Ah, I was missing the Do you want me to update this PR with the new patch, or do you want to make a new PR? |
Please update this PR. |
Done. Thanks for looking at this so quickly @aprokop |
Needs formatting fix. I can do that if you prefer. |
I added a commit after running |
GCC failed for unrelated reason (cc1plus killed). Merging. |
This is a small change to avoid a compiler warning on both Intel and Nvidia compilers. The warning is incorrect, but it is muddying up compile output and the dashboard results for the Sierra Toolkit.
The warning is that (sometimes) the compiler thinks:
is missing a return statement.