https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78221

            Bug ID: 78221
           Summary: [6 Regression] bogus warning: Non-zero imaginary part
                    discarded in conversion [-Wconversion]
           Product: gcc
           Version: 6.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: janus at gcc dot gnu.org
  Target Milestone: ---

Consider this piece of code:

complex, parameter :: i = (0.,1.)
complex :: t
t = (i)
end


Compiling with gfortran 6.2 (using -Wall) yields:

 complex, parameter :: i = (0.,1.)
                         1
Warning: Non-zero imaginary part discarded in conversion from ‘COMPLEX(4)’ to
‘REAL(4)’ at (1) [-Wconversion]


Two things are weird about this:
1) We only deal with complex quantities here and I don't see why a conversion
should happen at all.
2) The locus is wrong, pointing to the declaration of 'i' instead of the
assignment 't=(i)' that apparently triggers the warning.


The warning does not appear with gfortran 5.4, thus it's a regression.

Reply via email to