Comments (5)
Preprocessor symbols are the wrong way for CMake to detect the compiler identity and just about anything else. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58016#c4 for an example where preprocessor symbols are intentionally wrong. If CMake needs to know if -Mipa=fast
is valid, CMake should attempt to use it. This is how Autotools detects compiler support, which is the Right Way to do it.
Note also that preprocessing is not standard Fortran, so the entire premise of https://gitlab.kitware.com/cmake/cmake/blob/master/Modules/CMakeFortranCompilerId.F.in is invalid. See http://fortranwiki.org/fortran/show/Preprocessors for details.
from flang.
Having supported Autotools projects with IBM, Cray, Intel, PGI, PathScale, GNU, and other vendor support for years, I know your description isn't accurate, but I'm not going to bother debating it here.
from flang.
I'm not going to defend the way CMake determines compiler identity, but it is the way it is, and it is awfully hard to get those folks to change direction. That aside, is it appropriate that flang defines __PGIC__
? Suppose I have some compiler bug workaround implemented for flang and I want to use a preprocessor variable to enable it? It looks like I'm using __PGIC__
, but flang and the PGI compiler aren't the same thing anymore, are they?
from flang.
Except for the fact that -Mipa=fast
does not result in an error with flang, it's just not recognized and creates a warning. In order to recognize this you would need to implement a way to detect if any compiler spits out a warning.
Quite literally, in order to know which set of flags can make sense for any compiler across platforms, CMake needs to sniff the compiler identity. You can't compare this to what autotools does - it expects a compiler to obey F77/FC semantics like gfortran does. Namely, it expects '-O2 -g' to work with a given compiler, and sets that as the default. CMake supports optimizations like IPO, which autotools does not outside of passing '-flto' (for GCC) in flags. If you want to create a system that's more contrived than just passing '-O2' for optimization or even grant the project the freedom to add specific flags for specific compilers, you're out of luck with autotools.
Furthermore, what you linked is unrelated to what CMake does. CMake detects the compiler identity and version, and not anything else. This is done by sniffing specific, compiler-specific identities - not by sniffing standard macros. Such macros are unreliable, but so far, outside of flang, I'm not aware of any C/C++/Fortran compiler CMake would fail to detect properly.
Lastly, preprocessing might not be standard Fortran, but CMake supports virtually all Fortran compilers on the market (Intel, GCC, G95, Absoft, NAG, PGI, IBM, Oracle/SunPro, ...) and on each of those this method works reliably to detect the compiler and its version. At the moment, no major compiler - certainly none listed in the Fortran Forum reports - wouldn't work this way. For practical purposes it doesn't matter at all whether it's standard or not as long as there is a way to work with it anywhere. As argued before, a system like CMake has not alternative to this process unless it drops to primitive assumptions on the compiler like autotools does.
from flang.
This issue is now fixed in the commit mentioned above.
from flang.
Related Issues (20)
- [OMP_OFFLOAD_LLVM] Crash due to gbl.ompaccfile is NULL HOT 4
- [OMP_OFFLOAD_LLVM] Undefined references to .omp_offloading symbols HOT 3
- Regression caused by #PR1076 HOT 3
- Fix 'dllimport' code generation for opaque type
- Error while build classic flang with llvm 16.04 HOT 2
- SPEC2017 521_r run error HOT 14
- error: expected '(' HOT 2
- Incorrect information when the type-spec for the dimension of the function result contains the UBOUND intrinsic. HOT 2
- flang bug about cbind HOT 2
- Flang about its LLVM IR HOT 3
- The 'contiguous' attribute does not enforce an array passed to a subroutine to be contiguous
- flang-new version 17 and 18 compiler crash HOT 2
- 521.wrf_r segfaults when built with -flto=full -O2 HOT 17
- flang always produces debuginfo HOT 2
- [from discourse] Wrong understanding of the rules for lbound and ubound for non-pointer dummy arguments HOT 6
- Uninitialized stack variable during string initialization in a function that returns a string of the parametrized length
- `malloc(): corrupted top size` after allocating array of polymorphic data type elements
- [regression] An ICE while building libmbd after PR #1422 HOT 3
- ICE while building libmbd HOT 1
- Port Classic Flang to RISC-V HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flang.