Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

warning #167: argument of type "const char *" is incompatible with parameter of type "const char *"

erling_andersen
New Contributor I
6,473 Views
Using Intel 16.0.2 on Windows I get

seqbla16.c(3909): warning #167: argument of type "const char *" is incompatible with parameter of type "const char *"
              _mm_prefetch((char const *) (outvec+i),_MM_HINT_NTA);

How come 

const char *

is not compatible with

const char *

?

 

 

 

0 Kudos
11 Replies
KitturGanesh
Employee
6,473 Views

Hi @erling_Andersen,
That's interesting but I couldn't reproduce that warning with small test cases I tried with that prefetch call.  Can you please attach a test reproducer? Appreciate much, for your help.

Kittur

0 Kudos
erling_andersen
New Contributor I
6,473 Views

It is not that important.  I just thought it was strange.

0 Kudos
KitturGanesh
Employee
6,473 Views

Hi @erling_Andersen,
Thanks but still it's an interesting issue to fix. Unfortunately, I cannot file an issue with developers unless I have a reproducer. If I bump into this warning I'll surely let them know. Again, appreciate for letting us know.

Thanks,
Kittur

0 Kudos
erling_andersen
New Contributor I
6,473 Views

I will get back if manage to create a small example.

0 Kudos
Bernard
Valued Contributor I
6,473 Views

Try to use reinterpret_cast<const char*>(outvec + i) and see if the warning still persists. 

0 Kudos
erling_andersen
New Contributor I
6,473 Views

Here is how to reproduce the issue


-out:testprefetch.exe
testprefetch.obj

c:\Users\eda\mosekdbg>ICL /Wcheck testprefetch.c
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.2.180 Build 20160204
Copyright (C) 1985-2016 Intel Corporation.  All rights reserved.

testprefetch.c
testprefetch.c(11): warning #167: argument of type "const char *" is incompatible with parameter of type "const char *"
    _mm_prefetch((const char *) x,_MM_HINT_NTA);
                 ^

Microsoft (R) Incremental Linker Version 11.00.50727.1
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:testprefetch.exe
testprefetch.obj

where

 

#include <stdio.h>
#include <xmmintrin.h>

 


int main()
{
  double x[2];

  _mm_prefetch((const char *) x,_MM_HINT_NTA);
}

 

 

0 Kudos
Judith_W_Intel
Employee
6,473 Views

 

According to the MSDN documentation here:

https://msdn.microsoft.com/en-us/library/84szxsww%28v=vs.90%29.aspx?f=255&MSPPError=-2147217396

the first argument to _mm_prefetch takes a char* argument not a const char*.

So I think the warning should really say argument of type "const char*" is incompatible with parameter of type "char*".

I think the compiler is confused because it's an intrinsic (i.e. there is no prototype in the header file).

 

 

0 Kudos
KitturGanesh
Employee
6,473 Views

@erling_Andersen, - thanks I could reproduce the issue.

Hi Judy, I'll go ahead and file a CQ on this.
Thanks,
Kittur

0 Kudos
KitturGanesh
Employee
6,473 Views

Issue# filed is: DPD200410062

0 Kudos
erling_andersen
New Contributor I
6,472 Views

Your reference is to Visual Studio 2008. In Visual Studio 11 it has the more correct declaration

extern void _mm_prefetch(char const*_A, int _Sel);

0 Kudos
KitturGanesh
Employee
6,472 Views

I agree. More recent MS versions have changed the prototype from char* to const char*  - thanks.

Kittur

0 Kudos
Reply