public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/52884] New: double precision constants promoted to 16 byte by -fdefault-real-8
@ 2012-04-05 21:51 steven.vancoillie at gmail dot com
  2014-01-07 14:25 ` [Bug fortran/52884] " dominiq at lps dot ens.fr
  0 siblings, 1 reply; 2+ messages in thread
From: steven.vancoillie at gmail dot com @ 2012-04-05 21:51 UTC (permalink / raw)
  To: gcc-bugs

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)


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug fortran/52884] double precision constants promoted to 16 byte by -fdefault-real-8
  2012-04-05 21:51 [Bug fortran/52884] New: double precision constants promoted to 16 byte by -fdefault-real-8 steven.vancoillie at gmail dot com
@ 2014-01-07 14:25 ` dominiq at lps dot ens.fr
  0 siblings, 0 replies; 2+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-01-07 14:25 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52884

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2014-01-07
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
If I replace kind(1.d0) with kind(1.0_8), I get '8 16 8' with -fdefault-real-8.

I am in favor to replace 'does promote the default width of DOUBLE PRECISION to
16 bytes if possible' with something such as 'does promote the default width of
DOUBLE PRECISION to 16 bytes if possible, as well as double real constants like
1.d0' and 'The kind of real constants like "1.d0"' with 'The kind of real
constants like "1.0_8"'.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-07 14:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-05 21:51 [Bug fortran/52884] New: double precision constants promoted to 16 byte by -fdefault-real-8 steven.vancoillie at gmail dot com
2014-01-07 14:25 ` [Bug fortran/52884] " dominiq at lps dot ens.fr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).