[Bug fortran/64530] [4.9 Regression] Incorrect calculation when assigning to array with -O3
anlauf at gmx dot de
gcc-bugzilla@gcc.gnu.org
Wed Jan 7 22:36:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64530
Harald Anlauf <anlauf at gmx dot de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gmx dot de
--- Comment #1 from Harald Anlauf <anlauf at gmx dot de> ---
(In reply to jkaus from comment #0)
> With O3 we get the wrong result (0.0):
> gfortran -O3 a.F90
> ./a.out
> > buggy 0.0000000000000000 0.0000000000000000 0.0000000000000000
> > works 3.5000000000000000 3.5000000000000000 3.5000000000000000
Interesting bug. I can confirm that it does not occur with 4.8,
but with 4.9 and 5.
Note that if one interchanges in subroutine "buggy" the lines
old(i) = ave(i)
tmp(i) = tmp(i) / scale_factor
to
tmp(i) = tmp(i) / scale_factor
old(i) = ave(i)
I also get the correct result.
With gfortran 4.9 and 5 I also get the correct result with -O3
when e.g. using UBSAN (-fsanitize=undefined); it probably also
reduces the optimization.
Since the dump tree looks the same for 4.8 and 4.9, could it be
a middle-end bug?
More information about the Gcc-bugs
mailing list