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

Possible bug in conneciton to OpenMP

DominikT
Beginner
956 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
4 Replies
NoorjahanSk_Intel
Moderator
918 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


0 Kudos
DominikT
Beginner
837 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

0 Kudos
Viet_H_Intel
Moderator
898 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,

 

0 Kudos
Viet_H_Intel
Moderator
484 Views

This issue will be fixed in the next update release.

Hence, I am going to close this case. If you have any other questions/concerns, please create a new thread.


Thanks,


0 Kudos
Reply