This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/52884] New: double precision constants promoted to 16 byte by -fdefault-real-8
- From: "steven.vancoillie at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 05 Apr 2012 21:50:56 +0000
- Subject: [Bug fortran/52884] New: double precision constants promoted to 16 byte by -fdefault-real-8
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52884
Bug #: 52884
Summary: double precision constants promoted to 16 byte by
-fdefault-real-8
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: steven.vancoillie@gmail.com
Contrary to what the man pages say, double precision constants like '1.d0' get
promoted to 16 bytes when using -fdefault-real-8 (without -fdefault-double-8).
The man pages at the section of -fdefault-double-8 say however that
-fdefault-real-8 does not promote constants like that. Is this an error in the
man pages?
>From the man pages:
-fdefault-double-8
Set the "DOUBLE PRECISION" type to an 8 byte wide type.
If -fdefault-real-8 is given, "DOUBLE PRECISION" would instead be
promoted to 16 bytes if possible, and -fdefault-double-8 can be used
to prevent this. The kind of real constants like "1.d0" will not be
changed by -fdefault-real-8 though, so also -fdefault-double-8 does
not affect it.
Using e.g. the following program:
program doubletrouble
real*8 x
double precision y
write(*,*) kind(x), kind(y), kind(1.d0)
end
Compiling without any options gives '8 8 8' as output. Compiling with
-fdefault-real-8 gives '8 16 16', while I expected it to be '8 16 8' based on
the documentation.
This is with gfortran 4.7.0 on Linux x86_64 (Intel Core i5 M 540)