This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: fortran optimization errors


On Sat, Jun 23, 2007 at 02:15:00AM +0200, Tobias Schl?ter wrote:
> Steve Kargl wrote:
> >>>>>(3)  1.032407088285647E-002
> >>>>>(4)  1.032407088285647E-002
> >>Where is this numerical output written?
> >>
> >
> >Nevermind.  Your code is full of precision problems.  A glance at
> >semn17.f90 shows
> >
> > 	double precision, parameter :: pi=4.0*atan(1.0), ot=1.0/3.0
> >	double precision, parameter :: p2=pi/(3.0*sqrt(3.0)), 
> >	p3=pi/(3.0*sqrt(2.0))
> >	double precision, parameter :: KbT=428.208690545*(0.0)
> >
> >You have single precision constants (24-bits) on the RHS of these 
> >equations, and you're setting double precision (53-bits) quantities
> >on the LHS.
> 
> While this is a real problem, it shouldn't be affected by optimization, 
> because unless I'm mistaken the constants are converted to the right 
> types inside the frontend.
> 

The program contains REAL(4) and REAL(8) variables in mixed mode
arithmetic where these and other parameters are used.  Sebastian
doesn't see a problem on PPC only on i686 where FP registers are
80-bit.  He needs to either fix his code, use -ffloat-store, or
-fdefault-real-8.  The latter option may not help.

troutmask:sgk[204] gfc4x -c -Wconversion semn17.f90 |& grep REAL > sgk.log
troutmask:sgk[207] grep 'REAL(4) to REAL(8)' sgk.log | wc -l
     195
troutmask:sgk[208] grep 'REAL(8) to REAL(4)' sgk.log | wc -l
      69
troutmask:sgk[209] head sgk.log
Warning: Conversion from REAL(4) to REAL(8) at (1)
Warning: Conversion from REAL(4) to REAL(8) at (1)
Warning: Conversion from REAL(4) to REAL(8) at (1)

-- 
Steve


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