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

Build fails with gcc9 because of -Wstrict-overflow=5 which is too high #241

Closed
lgbaldoni opened this issue May 31, 2019 · 3 comments
Closed

Comments

@lgbaldoni
Copy link

Trying to build 2.3.2 on openSUSE Tumbleweed, see log.

@onqtam
Copy link
Member

onqtam commented Jun 1, 2019

doctest is built with GCC 9 on Travis CI with no errors. I suppose that on openSUSE the version of gcc 9 might be a tiny bit different. This warning (turned into an error) is not at all important - it is the result of -Wstrict-overflow=5 which is a total overkill (the level 5 - really easy to "break"). On this high level most reports are not real bugs but just a diagnostic.

I've had such errors previously with specific versions of GCC - notice that it reports the errors on line 51 of main.cpp - that is the last line of the source file. The reason this happens is because something gets inlined from the header into the source file and only then is the warning triggered - so this happens only in Release mode.

I cannot reproduce this with my local GCC 9 - I bet it's version is a bit different from yours. Here is what we can do:

  • you could just trust me that this is not an important error and just use the doctest header
  • I could somehow figure out which function gets inlined in the .cpp and mark it as "noinline" so it stays within the header where this warning is silenced
  • I could reduce the level of the warning since 5 is impractical and just wastes our time

I'll think how to handle this ... "error" when I get the chance - I'm currently buried in work.

@lgbaldoni
Copy link
Author

No biggie, I will simply fall back on gcc8 for the time being.

@onqtam onqtam changed the title Build fails with gcc9 Build fails with gcc9 because of -Wstrict-overflow=5 which is too high Jun 2, 2019
@onqtam
Copy link
Member

onqtam commented Jun 2, 2019

forget about me saying that GCC 9 builds were passing - they were not: https://travis-ci.org/onqtam/doctest/jobs/538141168

it was in the allowed failures part of the Travis CI build matrix because gcc 9 wasn't available until recently. Anyway I just committed some stuff and will wait for the builds when I push the changes.

I was also using GCC 8 locally when testing things out........ my bad :|

onqtam added a commit that referenced this issue Jun 2, 2019
onqtam added a commit that referenced this issue Jun 2, 2019
onqtam added a commit that referenced this issue Jun 2, 2019
@onqtam onqtam closed this as completed in f8b5ba6 Jun 2, 2019
onqtam added a commit that referenced this issue Jun 2, 2019
onqtam added a commit that referenced this issue Jun 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants