__kernel void PrintfWarning()
{
long i = get_global_id(0);
printf("%i\n", i);
}
When I compile above code, compiler said:
line 5: warning: argument
of type "const __constant char *" is incompatible with parameter of
type "__constant char *"
printf("%i\n", i);
^
How can I fix this?
I don't have to fix but just ignore?
I tested your kernel, but there was nothing wrong. Windows7 x64 pro SP1. HD 5650(8.96). AMD-SDK2.7 .
Didn't you get any warnings from compiler?
I know there was nothing wrong because it's not an error but just a warning, except with "-Werror".
No warning.
Hi aokomoriuta,
I'm very sorry, I made a mistake. I got the same result with you by using KernelAnalyzer to compile the kernel. .
This appears to be a defect in the compiler.
I have created a bug report. (For my reference 359250).
If the diagnostic is troublesome, you can insert a cast to quiet it.
printf((__constant char *)"%d\n", i);
Any news on this? I'm still seeing the spurious warning on AMD Platform Version "OpenCL 1.2 AMD-APP (1526.3)". I know there's a trivial workaround so this bug probably has low priority, but it seems also trivial to fix ...
It only tells about the error, if other errors are found - in practise it's handled as a warning. But it should be fixed anyway because of the Peter-and-the-wolf effect.
Thanks, and Vincent Hindriksen as well. I'll see this gets back into the engineering queue. I suspect you're right about it being low priority, and I don't promise a fix.
When I checked it using latest catalyst Omega driver (14.12) and CodeXL 1.6 on Windows 7(64 bit), I found that its compiling fine without any warning for every gpu devices except cpu (see the attached file). I got the same warning only for cpu device. Please confirm whether you've similar observation or not. Meanwhile, I'll check the status of that bug report and if required, will wake it up again or create a new one.
Regards,
It was on the CPU only, indeed.
(Other small annoyances: just got http://devgurus.amd.com/message/1306204 - haven't solved "Error: no .astext section found." )
Here are my results, to confirm:
========== Build started: Building kernels.cl on 2 devices. ==========
Compiling device: AMD A10-5750M APU with Radeon(tm) HD Graphics... Succeeded!
###/kernels.cl, line 393: warning: argument of type
"const __constant char *" is incompatible with parameter of type
"__constant char *" if (found) printf ("Found for locID %i, gateID %i, bits %i", locID, gateID, bits);
Compiling device: Iceland... Succeeded!
Error: no .astext section found.
========== Build: 2 of 2 succeeded ==========
VincentSC, thanks for this confirmation. The bug report has been re-initiated and forwarded to engg. team. Once I get any update, I'll share with you.
Regards,