This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/32391] Wrong code with optimization on i686-pc-linux-gnu
- From: "kargl at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Jun 2007 20:47:41 -0000
- Subject: [Bug fortran/32391] Wrong code with optimization on i686-pc-linux-gnu
- References: <bug-32391-14714@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #14 from kargl at gcc dot gnu dot org 2007-06-18 20:47 -------
(In reply to comment #13)
> The '-ffloat-store' option works! Thank you.
>
> However that gave me some quenstions;
>
> Is that feature or bug?
It is a 'feature' of the i386 class of cpu. See PR 323 for
details.
> There is many floating point operations of course.
> Why the only one specific resion make problem?
The floating point operations are done with 80-bit
precision and the intermediate results that are left
in a register have the extra precision. Double precision
has 53 bits of precision and single precision has 24
bits. The mixed mode arithmetic that ftnchek warns
about can cause the type of problem you are seeing.
The -ffloat-store option forces the contents in a register
after a floating pointing operation to be written to main
memory and then re-read. This removes the extra precision.
> That is not set when optimize.
> So, what's the disadvantage and
> why the 'fortran' with many floating point operation
> dosn't take it when optimize?
You'll need to review the code. I'd suggest first eliminating
the warns produced by ftnchek. If the problems disappear, then
be happy. If the problems are still present, you'll need to
review the floating point operations in the code.
> Why x86 need that option but x86_64 or PPC do not need?
These cpus do not store intermediate results in 80-bit register.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32391