[Bug c++/66943] GCC warns of Unknown Pragma for OpenMP, even though it support it.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66943 Eric Gallager changed: What|Removed |Added Keywords||diagnostic, openmp Status|UNCONFIRMED |NEW Last reconfirmed||2017-08-25 CC||egallager at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #10 from Eric Gallager --- (In reply to Manuel López-Ibáñez from comment #5) > (In reply to Jeffrey Walton from comment #4) > > (For what its worth, I understand the compiler writers are always right. > > They are demi-gods in my little corner of the universe :) > > You can also be a compiler writer: > https://gcc.gnu.org/wiki/GettingStarted#Basics:_Contributing_to_GCC_in_10_easy_steps > > For what is worth, I understand the point by Andrew that without -fopenmp, > the #pragmas are effectively ignored, thus the warning seems useful. Perhaps > it would be more useful a specific -Wopenmp-pragmas that says: > > warning: ignoring '#pragma omp parallel' without '-fopenmp' > [-Wopenmp-pragmas] > > But it seems more important to fix PR53431, if someone has time for that. > > The zero-column ":0" in the diagnostic is also a bug. Confirming these points.
[Bug c++/66943] GCC warns of Unknown Pragma for OpenMP, even though it support it.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66943 Martin Sebor changed: What|Removed |Added CC||msebor at gcc dot gnu.org --- Comment #9 from Martin Sebor --- *** Bug 71479 has been marked as a duplicate of this bug. ***
[Bug c++/66943] GCC warns of Unknown Pragma for OpenMP, even though it support it.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66943 --- Comment #1 from Jeffrey Walton noloader at gmail dot com --- I've experienced this issue on Cygwin i386 and x86_64 running GCC 4.8.1; Fedora 21 and 22, i386 and x86_64 running GCC 4.9 and 5.1, and a few others. So it appears to be a widespread issue, and not an isolated case.
[Bug c++/66943] GCC warns of Unknown Pragma for OpenMP, even though it support it.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66943 --- Comment #2 from Jeffrey Walton noloader at gmail dot com --- My bad... Here's the error message: g++ -DNDEBUG -g2 -O3 -Wall -march=native -pipe -c nbtheory.cpp nbtheory.cpp:655:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas] #pragma omp parallel ^ nbtheory.cpp:656:0: warning: ignoring #pragma omp sections [-Wunknown-pragmas] #pragma omp sections ^ ...
[Bug c++/66943] GCC warns of Unknown Pragma for OpenMP, even though it support it.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66943 Manuel López-Ibáñez manu at gcc dot gnu.org changed: What|Removed |Added CC||manu at gcc dot gnu.org --- Comment #5 from Manuel López-Ibáñez manu at gcc dot gnu.org --- (In reply to Jeffrey Walton from comment #4) (For what its worth, I understand the compiler writers are always right. They are demi-gods in my little corner of the universe :) You can also be a compiler writer: https://gcc.gnu.org/wiki/GettingStarted#Basics:_Contributing_to_GCC_in_10_easy_steps For what is worth, I understand the point by Andrew that without -fopenmp, the #pragmas are effectively ignored, thus the warning seems useful. Perhaps it would be more useful a specific -Wopenmp-pragmas that says: warning: ignoring '#pragma omp parallel' without '-fopenmp' [-Wopenmp-pragmas] But it seems more important to fix PR53431, if someone has time for that. The zero-column :0 in the diagnostic is also a bug.
[Bug c++/66943] GCC warns of Unknown Pragma for OpenMP, even though it support it.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66943 --- Comment #3 from Andrew Pinski pinskia at gcc dot gnu.org --- The warning is correct though, maybe it should add a message about needing -fopenmp to have them to be known.
[Bug c++/66943] GCC warns of Unknown Pragma for OpenMP, even though it support it.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66943 --- Comment #4 from Jeffrey Walton noloader at gmail dot com --- (In reply to Andrew Pinski from comment #3) The warning is correct though, maybe it should add a message about needing -fopenmp to have them to be known. From a dumb user's point of view (folks like me): that behavior squashes a lot of the benefit of cross-platform sources and using parallel tasks. I think the OpenMP folks feel about the same. From http://openmp.org/wp/openmp-specifications/ and http://www.openmp.org/mp-documents/OpenMP4.0.0.pdf: Each directive starts with #pragma omp. The remainder of the directive follows the conventions of the C and C++ standards for compiler directives. In particular, white space can be used before and after the #, and sometimes white space must be used to separate the words in a directive. Preprocessing tokens following the #pragma omp are subject to macro replacement. There's no expectation that a conforming compiler will issue a warning for #pragma omp when -fopenmp is not in effect. In fact, I can't find authority to issue a warning from a conforming compiler. I think it would be much better to always accept `#pragma omp` *if* the compiler supports OpenMP, regardless of the status of `-fopenmp`. Conversely, if the compiler does not support OpenMP, then always issue an unknown pragma warning (modulo expected behavior of the diagnostic). Speaking from experience, OpenBSD and Cygwin get into an odd area where they advertise support for OpenMP by accepting -fopenmp and defining _OPENMP, but then fail to compile the program. But I think that's a different issue. (For what its worth, I understand the compiler writers are always right. They are demi-gods in my little corner of the universe :)
[Bug c++/66943] GCC warns of Unknown Pragma for OpenMP, even though it support it.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66943 --- Comment #8 from Jeffrey Walton noloader at gmail dot com --- (In reply to Jeffrey Walton from comment #6) Maybe it could be in effect with `-Wextra`? That would just move the problem somewhere else instead of fixing it. Many people do compile with -Wall -Wextra (like GCC itself). Yeah, but it works for me :) But more seriously, I understand what you are saying. When I have the luxury of a new project, I use -Wall -Wextra -Wconversion. Enabling Unknown Pragma warnings for #pragma omp under -Wall when the compiler supports it, coupled with the inability to manage warnings with 'pragma GCC diagnostic` (Bug #53431), means we just turned OFF -Wall. We are moving in the wrong direction :( You could always use -Wall -Wno-unknown-pragmas, but yes, fixing PR53431 seems the key here. I hope someone finds time to do that before GCC 6 closes for development. -Wno-unknown-pragmas is just one of many we need. Others appear to include -Wunused-variable, -Wunused-value and -Wunused-function. And we are no longer managing the warnings in the source code through a GCC diagnostic block; rather, we are polluting the command line. We produce a library, so we not only pollute our command line, we polute the user's command line. That's after the user complains about it because GCC diagnostic block don't just work. Does GCC have a Bounty program? If so, I'd be happy to make a donation. I'd even solicit a for grants because `-Wall` and managing warnings is *that* important. I feel awful that we yanked it for GCC. On the good side, our sources are cross-compiler and cross-platform, So we are effectively using -Wall for MSVC, Clang and ICC. But others don't have that luxury. For example, the Asterisk project uses trampolines, so the code does not compile under Clang (and it could never compile under MSVC).
[Bug c++/66943] GCC warns of Unknown Pragma for OpenMP, even though it support it.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66943 --- Comment #6 from Jeffrey Walton noloader at gmail dot com --- (In reply to Manuel López-Ibáñez from comment #5) ... For what is worth, I understand the point by Andrew that without -fopenmp, the #pragmas are effectively ignored, thus the warning seems useful. Perhaps it would be more useful a specific -Wopenmp-pragmas that says: Maybe it could be in effect with `-Wextra`? Enabling Unknown Pragma warnings for #pragma omp under -Wall when the compiler supports it, coupled with the inability to manage warnings with 'pragma GCC diagnostic` (Bug #53431), means we just turned OFF -Wall. We are moving in the wrong direction :(
[Bug c++/66943] GCC warns of Unknown Pragma for OpenMP, even though it support it.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66943 --- Comment #7 from Manuel López-Ibáñez manu at gcc dot gnu.org --- (In reply to Jeffrey Walton from comment #6) Maybe it could be in effect with `-Wextra`? That would just move the problem somewhere else instead of fixing it. Many people do compile with -Wall -Wextra (like GCC itself). Enabling Unknown Pragma warnings for #pragma omp under -Wall when the compiler supports it, coupled with the inability to manage warnings with 'pragma GCC diagnostic` (Bug #53431), means we just turned OFF -Wall. We are moving in the wrong direction :( You could always use -Wall -Wno-unknown-pragmas, but yes, fixing PR53431 seems the key here. I hope someone finds time to do that before GCC 6 closes for development.