Printf crashes nvcc on CUDA targets
|
|
Bugzilla Link |
941 |
Created on |
Mar 27, 2012 15:21 |
Version |
svn |
OS |
All |
Architecture |
PC |
Extended Description
Using the printf function and compiling SaC for CUDA generates invalid CUDA code, which crashes the nvcc compiler. A simple hello-world program is enough to cause this crash:
----------------------------
$ sac2c -target cuda world.sac
...
** 22: Creating binary code ...
**** Handling dependencies ...
**** Invoking C compiler ...
a.out.cu(204): error: more than one instance of overloaded function "printf" has "C" linkage
a.out.cu(685): warning: variable "SACp_tcp_924__emal_696__flat_1__shp0" was set but never used
a.out.cu(686): warning: variable "SACp_tcp_924__emal_696__flat_1__sz" was set but never used
a.out.cu(687): warning: variable "SACp_tcp_924__emal_696__flat_1__dim" was declared but never referenced
1 error detected in the compilation of "/tmp/tmpxft_00009db2_00000000-4_a.out.cpp1.ii".
ABORT: System failed to execute shell command
...
with exit code 2
*** Compilation failed ***
*** Exit code 373 (Creating binary code)
*** 1 Error(s), 4 Warning(s)
----------------------------
Contents of world.sac:
----------------------------
use StdIO: all;
use Array: all;
int main() {
printf( "Hello World!\n");
return(0); }
----------------------------
Using sac2c from svn, nvcc version 4.1, and gcc version 4.5.3.