- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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,

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page