cancel
Showing results for 
Search instead for 
Did you mean: 

OpenCL

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 Kudos
Reply
11 Replies
Wenju
Elite

Re: printf got warning "incompatible argument"

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

0 Kudos
Reply
aokomoriuta
Journeyman III

Re: printf got warning "incompatible argument"

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 Kudos
Reply
Wenju
Elite

Re: printf got warning "incompatible argument"

No warning.

0 Kudos
Reply
Wenju
Elite

Re: printf got warning "incompatible argument"

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 Kudos
Reply
rouellet
Staff
Staff

Re: printf got warning "incompatible argument"

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);

gbilotta
Adept III

Re: printf got warning "incompatible argument"

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 Kudos
Reply
VincentSC
Adept II

Re: printf got warning "incompatible argument"

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 Kudos
Reply
jtrudeau
Staff
Staff

Re: printf got warning "incompatible argument"

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 Kudos
Reply
dipak
Staff
Staff

Re: Re: printf got warning "incompatible argument"

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 Kudos
Reply