Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

warning 2259 by icpc -Wall -Wcheck

tanakmura
Beginner
575 Views

Hi,

Warning #2259 is caused when compile parallel_for with icpc(15.0) -Wall -Wcheck.

#include <tbb/parallel_for.h>

void f(void)
{
    using namespace tbb;
    parallel_for(0,1,1,
                 [&](int) {}
        );
}
$ icpc -Wall -Wcheck pfor.cpp -std=c++11 -c -I /opt/intel/tbb/include/

/opt/intel/tbb/include/tbb/partitioner.h(185): warning #2259: non-pointer conversion from "int" to "tbb::interface7::internal::depth_t={unsigned char}" may lose significant bits
          my_head = (my_head + MaxCapacity - 1) % MaxCapacity;
                  ^
          detected during:
<..snip..>

Is it safe? How do I disable it?


Thanks.

 

0 Kudos
3 Replies
RafSchietekat
Valued Contributor III
575 Views

It is safe, because both sides of the modulo operator will be positive (which the compiler does not know about the left side), and MaxCapacity is the same type as the destination, so that's sufficient for the result to be passed undamaged to my_head. A workaround could be to use "(depth_t)1".

(2014-12-11 Edited) MaxCapacity is the same type as the "destination", not the "result".

0 Kudos
tanakmura
Beginner
575 Views

Raf, thanks for your reply.

Modifying TBB header is not allowed because of my source code is compiled on some machines.
I will disable it by -diag-disable 2259.

0 Kudos
Vladimir_P_1234567890
575 Views

our developers looked at this and it looks that compiler 15.0 update 1 fixed this particular diagnostics.

--Vladimir

0 Kudos
Reply