[nvcc bug report] Xcompiler options not passed correctly to gcc.

Passing -Wp,… to GCC via -Xcompiler fails:

$ nvcc -Xcompiler “-Wp,-DFOO” helloworld.c -o helloworld
gcc: error: unrecognized command line option ‘-Wp’

On closer inspection:
nvcc -v -Xcompiler "-Wp,-DFOO" helloworld.c -o helloworld ... # gcc -c -x c -D__NVCC__ -Wp -DFOO “-I/usr/local/cuda/bin/…/targets/x86_64-linux/include” -m64 -o “/tmp/tmpxft_000067dd_00000000-4_helloworld.o” “helloworld.c”
gcc: error: unrecognized command line option ‘-Wp’

GCC doesn’t like the space between -Wp and -DFOO, as it requires a comma. Presumably this is nvcc munging the text?

Version info

Cuda compilation tools, release 7.0, V7.0.27
GCC 4.8.3 20140911 (Red Hat 4.8.3-9)
Operating system: CentOS 7 Linux.

Cheers,

Chris

try escaping the , with a backslash maybe?

Yup, that works, but seems a hack…

Thanks.