public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/47659] New: -Wconversion[-extra] should emit warning for constant expressions
@ 2011-02-09 10:41 thenlich at users dot sourceforge.net
  2011-02-09 16:21 ` [Bug fortran/47659] " kargl at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: thenlich at users dot sourceforge.net @ 2011-02-09 10:41 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: -Wconversion[-extra] should emit warning for constant
                    expressions
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: thenlich@users.sourceforge.net


When the options -Wconversion or -Wconversion-extra are in effect, the compiler
does not generate a warning if a constant real expression is converted to a
different real kind

There should be a warning in this case because the conversion can give
surprising results, e.g.:

real(8) d1, d2
d1 = .13 ! <== no warning
d2 = .13d0
print *, d1, d2, d2-d1
end

Output:
  0.12999999523162842       0.13000000000000000       4.76837158647214210E-009

In this case the option -Wconversion-extra should give a warning on "d1 = .13"
because a constant was specified which does not represent the decimal value
with the same precision as the target variable can hold. The user most likely
wanted to specify "d1 = .13d0"


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

end of thread, other threads:[~2015-06-06 16:20 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-09 10:41 [Bug fortran/47659] New: -Wconversion[-extra] should emit warning for constant expressions thenlich at users dot sourceforge.net
2011-02-09 16:21 ` [Bug fortran/47659] " kargl at gcc dot gnu.org
2011-07-30 23:08 ` tkoenig at gcc dot gnu.org
2011-08-07 19:31 ` tkoenig at gcc dot gnu.org
2011-08-07 21:21 ` tkoenig at gcc dot gnu.org
2011-08-08  6:08 ` thenlich at users dot sourceforge.net
2011-08-08 14:51 ` sgk at troutmask dot apl.washington.edu
2011-08-21 16:41 ` tkoenig at gcc dot gnu.org
2011-09-05  7:56 ` thenlich at users dot sourceforge.net
2012-05-04 16:12 ` david.folkner at gmail dot com
2012-12-23 21:55 ` anlauf at gmx dot de
2015-06-06 16:20 ` tkoenig at gcc dot gnu.org

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).