I was compiling some teplated CUDA code today, when suddenly, I get:
nvcc foo.cu -dc -o foo.o -m64 --std c++11 -gencode arch=compute_30,code=compute_30 -I/usr/local/cuda/include -I/path/to/includes
Segmentation fault (core dumped)
This is with CUDA 7.5 and GCC 4.9.3 on Debian Stretch. Boost and CUB are not actually used by the code triggering the segfault.
running gdb, I get:
...
Reading symbols from /usr/local/cuda/bin/cudafe++...(no debugging symbols found)...done.
[New LWP 26725]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `cudafe++ --allow_managed --m64 --gnu_version=40903 --c++11 --parse_templates --'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000000000458b48 in ?? ()
(gdb) bt
#0 0x0000000000458b48 in ?? ()
#1 0x0000000000447989 in ?? ()
#2 0x0000000000449a77 in ?? ()
#3 0x0000000000444d6b in ?? ()
#4 0x00000000004467f1 in ?? ()
#5 0x0000000000446bd5 in ?? ()
#6 0x00000000004536e7 in ?? ()
#7 0x0000000000446c95 in ?? ()
#8 0x00000000004536e7 in ?? ()
#9 0x0000000000446c95 in ?? ()
#10 0x0000000000448403 in ?? ()
#11 0x000000000040b042 in ?? ()
#12 0x00007f3637c17610 in __libc_start_main (main=0x40af50, argc=14, argv=0x7ffd24a32058, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffd24a32048) at libc-start.c:291
#13 0x0000000000401769 in ?? ()
#14 0x00007ffd24a32048 in ?? ()
#15 0x000000000000001c in ?? ()
#16 0x000000000000000e in ?? ()
#17 0x00007ffd24a33e7b in ?? ()
#18 0x00007ffd24a33e84 in ?? ()
#19 0x00007ffd24a33e94 in ?? ()
#20 0x00007ffd24a33e9a in ?? ()
#21 0x00007ffd24a33eae in ?? ()
#22 0x00007ffd24a33eb6 in ?? ()
#23 0x00007ffd24a33ec8 in ?? ()
#24 0x00007ffd24a33ed3 in ?? ()
#25 0x00007ffd24a33ee5 in ?? ()
#26 0x00007ffd24a33f16 in ?? ()
#27 0x00007ffd24a33f27 in ?? ()
#28 0x00007ffd24a33f56 in ?? ()
#29 0x00007ffd24a33f6c in ?? ()
#30 0x00007ffd24a33f9b in ?? ()
#31 0x0000000000000000 in ?? ()
So that's not very useful. What can I try doing to avoid this segfault? Or to figure out why it happens?
Edit: I just noticed this similar question - but it doesn't have an answer yet.
It seems like the reason for the crash is failure to prevent an inappropriate use of the using
keyword. Here's a non-MCVE (which I might make into an MCVE later):
enum class foo : bool { foolish = false, snafu = true };
template <typename T> class bar {
public:
using foo::foolish;
using foo::snafu;
}
This is incorrect C++, and should make the compiler give out an error, but for some reason, and possibly due to combination with more code not in this snippet, that didn't happen. Instead, cudafe++
is tricked into accepting that, gets confused and crashes.
As @talonmies suggested, will try to make a proper bug report to nVIDIA. ...
Edit: It's proving difficult to reproduce now :-(
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments