Community
cancel
Showing results for 
Search instead for 
Did you mean: 
erling_andersen
Beginner
1,613 Views

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

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
Kittur_G_Intel
Employee
1,613 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

erling_andersen
Beginner
1,613 Views

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

Kittur_G_Intel
Employee
1,613 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

erling_andersen
Beginner
1,613 Views

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

Bernard
Black Belt
1,613 Views

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

erling_andersen
Beginner
1,613 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);
}

 

 

Judith_W_Intel
Employee
1,613 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).

 

 

Kittur_G_Intel
Employee
1,613 Views

@erling_Andersen, - thanks I could reproduce the issue.

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

Kittur_G_Intel
Employee
1,613 Views

Issue# filed is: DPD200410062

erling_andersen
Beginner
1,613 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);

Kittur_G_Intel
Employee
1,613 Views

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

Kittur

Reply