This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, fortran] PR 47359 - warnings for constant conversion


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]