From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18354 invoked by alias); 25 Nov 2007 21:44:31 -0000 Received: (qmail 18332 invoked by uid 48); 25 Nov 2007 21:44:25 -0000 Date: Sun, 25 Nov 2007 21:44:00 -0000 Subject: [Bug fortran/34230] New: Expressions of parameters evaluated with too high precision X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "burnus at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-11/txt/msg02424.txt.bz2 Found by FX. See http://gcc.gnu.org/ml/fortran/2007-11/msg00208.html $ cat a.f90 real, parameter :: y = exp(log(huge(y))+20) real, parameter :: x = log(y) print *, x, y end $ gfortran a.f90 -fno-range-check && ./a.out 108.72284 +Infinity The problem is the following: gfortran does not do: y = INF x = log(y) = log(INF) = INF but it does: y = exp(log(huge())+20) = INF x = log(exp(log(huge())+20)) = log(huge())+20 = 108.7 Calculating with higher precision to obtain "y" is ok (though one gets different results compared with the run-time evaluation, but I expect that the differences are only minor. Having the correct precision from the beginning would be also ok.) However, I regard it as bug if for expressions using y not y but a variant with higher precision. -- Summary: Expressions of parameters evaluated with too high precision Product: gcc Version: 4.3.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34230