This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch, fortran] PR 47359 - warnings for constant conversion
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: Thomas Koenig <tkoenig at netcologne dot de>
- Cc: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 1 Jun 2015 06:40:17 -0700
- Subject: Re: [patch, fortran] PR 47359 - warnings for constant conversion
- Authentication-results: sourceware.org; auth=none
- References: <556B7ED1 dot 4020304 at netcologne dot de> <20150531221425 dot GA34602 at troutmask dot apl dot washington dot edu> <556BFCF0 dot 5030607 at netcologne dot de>
On Mon, Jun 01, 2015 at 08:34:24AM +0200, Thomas Koenig wrote:
>
> >> 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?
>
Is it possible to detect the _knd suffix? If so, no
warning is my preference as it is never incorrect to
specify more digits than required for conversion from
ASCII to an internal representation. This, of course,
assumes that the compiler doesn't have a bug.
>
> Comments?
>
I'm not a big fan of a proliferation of options. As long
as the warning isn't triggered under -Wall, I suppose
I can live with -Wconversion-extra.
--
Steve