[Bug fortran/59168] New: Wrong result with non-optimized (!) compilation
sarantis.pantazis at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Nov 18 10:13:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59168
Bug ID: 59168
Summary: Wrong result with non-optimized (!) compilation
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: sarantis.pantazis at gmail dot com
I wanted to check the difference in CPU time in the calculation of a sum when
the terms are included in the same expression and when they are added
separately. For this reason I wrote the attached code.
First I compiled with
"gfortran -o test testPartialSum.f08"
and got the following results:
199204048.
67108864.0
0.117000006 0.244000003
Then I compiled with
"gfortran -o test testPartialSum.f08 -O3"
and got the following results:
200000000.
200000000.
7.80000016E-02 7.50000030E-02
It seems clear that the optimized compilation provides the correct results but
the non-optimized one does not (which seems very weird to me!!!).
>uname -a
Linux i75454 3.7.10-1.16-desktop #1 SMP PREEMPT Fri May 31 20:21:23 UTC 2013
(97c14ba) i686 i686 i386 GNU/Linux
>cat /etc/issue
Welcome to openSUSE 12.3 "Dartmouth" - Kernel \r (\l).
>gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/myUserame/gcc-latest/gcc-4.8.2/lib/gcc/i686-pc-linux-gnu/4.8.2/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../configure --prefix=/home/myUsername/gcc-latest/gcc-4.8.2
--enable-languages=c,fortran,c++
Thread model: posix
gcc version 4.8.2 (GCC)
More information about the Gcc-bugs
mailing list