Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
7678 Discussions

Possible bug in conneciton to OpenMP

DominikT
Beginner
417 Views

Hello everyone,

I came across a strange compiler error when using OpenMP and created a minimal example:

template< typename T > 
inline int int_c( T t ) { 
    return static_cast< int >( t ); 
} 

int main() 
{
    int n2 = int_c(10);
#pragma omp parallel for
    for( int i=n2; i<10; ++i )
        int foo = i;
}

 

when using version 2021.3.0 of the C++ compiler and these compiler flags:

-Wconversion -fopenmp -Werror

the following error occurs:

<source>:10:16: error: implicit conversion changes signedness: 'int' to 'unsigned int' [-Werror,-Wsign-conversion]
    for( int i=n2; i<10; ++i )
    ~~~        ^~
1 error generated.
Compiler returned: 1

 

I also created a link to godbolt:

https://godbolt.org/z/6xb58Y987

 

Is this indeed a bug or am I missing something?

Thanks a lot for any help!

0 Kudos
3 Replies
NoorjahanSk_Intel
Moderator
379 Views

Hi,

Thanks for reaching out to us.

We are also able to reproduce the issue on our end with icx compiler. We are looking into this issue internally. We will get back to you soon.


Meanwhile could you please try using icc/icpc compiler to compile your source code.


Thanks & Regards

Noorjahan


DominikT
Beginner
298 Views

Hi,

 

it looks like this Problem comes from the LLVM infrastructure.

https://bugs.llvm.org/show_bug.cgi?id=48387

So I guess it will be solved in a future version automatically.

 

Thanks for your answers.

Dominik

Viet_H_Intel
Moderator
359 Views

Compiler gives a spurious warning, but since you promoted to an error, it became an error.

You can either remove -Werror flag or add -Wno-sign-conversion.

 

Thanks,

 

Reply