Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler warning with Intel compiler, same as #755 #2712

Closed
1 of 5 tasks
philbucher opened this issue Apr 13, 2021 · 1 comment · Fixed by #3227
Closed
1 of 5 tasks

Compiler warning with Intel compiler, same as #755 #2712

philbucher opened this issue Apr 13, 2021 · 1 comment · Fixed by #3227
Assignees
Labels
kind: bug release item: 🔨 further change solution: proposed fix a fix for the issue has been proposed and waits for confirmation

Comments

@philbucher
Copy link

Using the intel compiler reports the following warning:

#186: pointless comparison of unsigned integer with zero
          const bool is_negative = std::is_same<NumberType, number_integer_t>::value && !(x >= 0); // see issue #755

I tried the solutions posted in #755 and others (e.g. this one) but I couldn't get it to work.
I also tried with std::signed & std::unsigned but no success either

@nlohmann you could add the Intel compiler to the CI with the oneAPI
Looking at your github actions script this should be doable without too much effort. I'd be happy to help :)
You could install the compiler in what I assume is a docker image (nlohmann/json-ci:latest)

What is the issue you have?

cannot turn all warnings into errors

Please describe the steps to reproduce the issue.

Compile with ICC with e.g. Werror-all

Can you provide a small but working code example?

What is the expected behavior?

Compiles without warnings

And what is the actual behavior instead?

Warning is issued

Which compiler and operating system are you using?

  • Compiler: Intel 20.2.2.20210228 (through oneAPI)
  • Operating system: Ubuntu 20.04

Which version of the library did you use?

  • latest release version 3.9.1
  • other release - please state the version: ___
  • the develop branch

If you experience a compilation error: can you compile and run the unit tests?

  • yes
  • no - please copy/paste the error message below
@nickaein
Copy link
Contributor

I'm not sure whether this issue counts as ICC compiler bug or not, but just for the sake of testing can you try the workaround that is provided here #755 (comment) to see if this can suppress the warning?

I tried to reproduce the issue on Compiler Explorer which supports ICC/ICX compilers. It may not support the specific version you are using though and I couldn't reproduce the issue. Can you also give it a try? An online compiler can make working on the issue much easier.

Here is my (failed) attempt, which by the way is giving out another misguided warning: https://godbolt.org/z/nKreE4xW6

@nlohmann nlohmann linked a pull request Dec 29, 2021 that will close this issue
@nlohmann nlohmann self-assigned this Dec 30, 2021
@nlohmann nlohmann added release item: 🔨 further change solution: proposed fix a fix for the issue has been proposed and waits for confirmation labels Dec 30, 2021
@nlohmann nlohmann added this to the Release 3.10.5 milestone Dec 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug release item: 🔨 further change solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants