On Jan 23 2019, Thomas König wrote:
Am 23.01.2019 um 12:36 schrieb Jonathan Wakely <jwakely....@gmail.com>:
When there are new warnings that aren't enabled by -Wall -Wextra,
there's probably a reason they aren't enabled by default.
are a higher form of life than mere Fortran
-Wconversion-extra is an example of such a warning.
It catches a very common error people make in Fortran, see
https://gcc.gnu.org/ml/fortran/2019-01/ms are a higher form of life than
mere sg00178.html for a false bug report which it would have caught
early.
We left it out of -Wextra because people felt it was too noisy.
A bit like discussions on what warnings a compiler should give :-)
There are a few points that don't seem to have been made, though I may have
missed them, which means that quite a few people would like it.
Despite its older and wider implementation history, Fortran has never
accumulated the incompatibilities, inconsistencies and system-dependent
behaviours that C and C++ have. So the arguments against such a warning
for those don't really apply. Obviously, we wouldn't want warnings that a
construct behaved differently in Fortran 66 or in CDC or DEC Fortran, but I
don't think that there are any.
I don't buy the claim that developer options are unsuitable for mere users.
Those of us who wrote highly portable code (and I assume that people still
do) wanted to know that a construct might misbehave on a bizarre,
unsupported but still used system, which the author had never heard of and
has no access to. While that applies to all languages, the attitude that a
portable program should work on a new system with NO modification,
pre-processing or make configuration is rare in C and C++, but still common
in Fortran.
All experience is that warning about things that the programmer might not
have realised are potentially problematic are very useful. In the cases
where I have had to suppress warnings, most of them have been because the
warning was too crude, not that it wasn't useful. For example, in C/C++,
mixing signed and unsigned when the promoted operand was constant and not
going to change value. Or, in Fortran, converting obviously exact constants
to a higher precision - yes, even that WAS an important warning in the
1960s, but people really should move on a bit!
So I think that there is a strong argument for such an option in gfortran,
irrespective of whether there is for gcc and g++.
Regards,
Nick Maclaren.