cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

aokomoriuta
Journeyman III

printf got warning "incompatible argument"

__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?

  • Windows7 x64 pro SP1
  • Radeon HD 6950 (8.980.0.0)
  • KennelAnalyzer ver 1.12.1288
0 Likes
11 Replies
Wenju
Elite

I tested your kernel, but there was nothing wrong. Windows7 x64 pro SP1. HD 5650(8.96). AMD-SDK2.7 .

0 Likes

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".

0 Likes

No warning.

0 Likes

Hi aokomoriuta,

I'm very sorry, I made a mistake. I got the same result with you by using KernelAnalyzer to compile the kernel. .

0 Likes
rouellet
Staff

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 ...

0 Likes

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.

0 Likes

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.

0 Likes

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,

0 Likes

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 ==========

0 Likes

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,

0 Likes