refused to compile. The error message was (using gcc version 4.1.2):
[font=“Courier”]matrixmul_drv.cpp: In function ‘CUresult initCUDA(char*, CUfunc_st**)’:
matrixmul_drv.cpp:207: error: jump to label ‘Error’
matrixmul_drv.cpp:191: error: from here
matrixmul_drv.cpp:193: error: crosses initialization of ‘char* module_path’
matrixmul_drv.cpp:207: error: jump to label ‘Error’
matrixmul_drv.cpp:187: error: from here
matrixmul_drv.cpp:193: error: crosses initialization of ‘char* module_path’
matrixmul_drv.cpp:207: error: jump to label ‘Error’
matrixmul_drv.cpp:184: error: from here
matrixmul_drv.cpp:193: error: crosses initialization of ‘char* module_path’[/font]
I took a look at the function and there seems to be a small error (I never used goto’s so I am not sure if this really is an error). I think [font=“Courier”]char* module_path[/font] should be defined before the first goto or the code after the error label can not be compiled/executed since it uses [font=“Courier”]module_path[/font]. :)
-Jens
BTW: Except that problem everything is working as expected even on an unsupported Ubuntu system. :)
Yes, this is indeed a bug in the sample code. We’ll have a fix in the next release. For now, you can easily fix it in your local copy:
If ( bug) goto Error;
char *p = new char[256]; // this line generates compile error
…
Error:
char *p;
If ( bug ) goto Error;
p = new char[256]; // no more compile error
...
Error: