[PATCH] D58463: [CUDA]Delayed diagnostics for the asm instructions.
Artem Belevich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 26 10:39:58 PST 2019
tra added a comment.
There's a new quirk we've ran into after this patch landed. Consider this code:
int foo() {
int prev;
__asm__ __volatile__("whatever" : "=a" (prev)::);
return prev;
}
When we compile for device, asm constraint is not valid for NVPTX, we emit delayed diag and move on. The function is never code-gen'ed so the diag never shows up. So far so good.
Now we add `-Werror -Wininitialized` and things break -- because we bail out early, `prev` is left uninitialized and is reported as such.
$ bin/clang++ -c --cuda-gpu-arch=sm_35 asm.cu -nocudainc --cuda-device-only -Wuninitialized -Werror
asm.cu:4:10: error: variable 'prev' is uninitialized when used here [-Werror,-Wuninitialized]
return prev;
^~~~
asm.cu:2:11: note: initialize the variable 'prev' to silence this warning
int prev;
^
= 0
1 error generated when compiling for sm_35.
I think this should also show up in the test case in this patch, too, if you add -Wuninitialized
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58463/new/
https://reviews.llvm.org/D58463
More information about the llvm-commits
mailing list