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: unassig...@gcc.gnu.org
        ReportedBy: thenl...@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"

Reply via email to