Nope, all fine, I just got flooded with warnings and I missed this one
i wonder where this should go, I am new to this.
I just spent an houre brooding over my code wondering what was missing, the I realized I forgot a return statement.
I did something like
__device__ inline Vec3f foo()
// no return statement!
Vec3f blargh = foo();
blargh is Vec3f(0).
So the compiler or whatever ignored the missing return statement.
Who is to blame? MS or Nvidia.
Please tell me where to forward this or whom this might concern.
Win7Prof, 560ti, Nsight2.2, msvc2010
The C/C++ standards only require a minimal set of diagnostic messages, not sure whether a missing return in a function with non-void return type requires a diagnostic, my best guess is that it is not required.
Obviously, a comprehensive set of warnings is condusive to improved programmer productivity. Unfortunately, I am not aware of NVCC flags that let programmers control warnings. With the Open64 compiler (still active when compiling for an sm_1x target), one could enable a comprehensive set of warnings for device code via component-level flags. Below I am showing the full list of the flags I used to use for my own CUDA projects for many years, you may find them helpful. I am not aware of equivalent ways of turning on these kind of warnings via component-level flags passed to the NVVM compiler used for sm_2x and sm_3x targets. The NVVM compiler is based on LLVM, so maybe someone with LLVM experience can provide a hint. In any event the use of component-level flags is for the most part unsupported, and as the Open64 experience shows, the component can disappear and the flags alogn with it.
You may want to file a bug with a feature request for the compiler to warn about missing return in a non-void function and any other warnings you find useful in your work.
NVCC_WARN = -Xopencc -Wall
NVCC_WARN += -Xopencc -Wcast-align
NVCC_WARN += -Xopencc -Wpointer-arith
NVCC_WARN += -Xopencc -Wstrict-prototypes
NVCC_WARN += -Xopencc -Wmissing-prototypes
NVCC_WARN += -Xopencc -Wnested-externs
NVCC_WARN += -Xopencc -Wformat
NVCC_WARN += -Xopencc -Wswitch
NVCC_WARN += -Xopencc -Wchar-subscripts
NVCC_WARN += -Xopencc -Wparentheses
NVCC_WARN += -Xopencc -Wmultichar
NVCC_WARN += -Xopencc -Wtrigraphs
NVCC_WARN += -Xopencc -Wno-unused-function
NVCC_WARN += -Xopencc -Wno-implicit-function-declaration