Hi Steve, >> The second part catches the case when the user supplies more >> digits than appropriate for the number. More often than not, >> this is a KIND error. >> > > Does the above issue warnings for > > real(knd), parameter :: pi = 3.1415926535897932384626433832795029_knd > > module foomod > > interface foo > module procedure foo4, foo8, foo10, foo16 > end interface foo > > contains > > subroutine foo4() > integer, parameter :: knd = 4 > include 'consts.def' > ! do something with pi > end subroutine > end module foomod
Yes, it does, if -Wconversion-extra is specified. > If warnings occur, then IMHO the patch cannot be committed > in its current form. What would be the peferred alternative? I can make this warning conditional on a new option, let's call it -Wconversion-constant, and have this set by default by -Wsurprising or by -Wconversion. The new options machinery is nice enough to specify the option name with the warning, so it is easy for a user to turn this particular warning off. It would also be possible to grade this warning for really fine-grained control: - Introduce -Wconversion-constant, enabled by -Wconversion, to warn about the most common error of a constant with excess precision without KIND, so print *,3.1415829535 would get a warning and print *,3.1415926535_4 would not. - Introduce -Wconversion-constant-extra, enabled by -Wconversion-extra, to warn about any excess precision regardless whether a KIND number is present in the constant or not. Comments? Thomas