This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch, fortran, committed] Fix PR 78221
- From: Thomas Koenig <tkoenig at netcologne dot de>
- To: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 6 Nov 2016 13:29:45 +0100
- Subject: [patch, fortran, committed] Fix PR 78221
- Authentication-results: sourceware.org; auth=none
Hello world,
I have committed the attached patch to the regression as obvious and
simple after regression-testing. Will commit to gcc 6 in a
few days.
Regards
Thomas
2016-11-06 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/78221
* arith.c (gfc_complex2real): Change gfc_warning_now to
gfc_warning.
2016-11-06 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/78221
* gfortran.dg/warn_conversion_9.f90: New test.
Index: arith.c
===================================================================
--- arith.c (Revision 241747)
+++ arith.c (Arbeitskopie)
@@ -2369,10 +2369,10 @@ gfc_complex2real (gfc_expr *src, int kind)
/* See if we discarded an imaginary part. */
if (mpfr_cmp_si (mpc_imagref (src->value.complex), 0) != 0)
{
- gfc_warning_now (w, "Non-zero imaginary part discarded "
- "in conversion from %qs to %qs at %L",
- gfc_typename(&src->ts), gfc_typename (&result->ts),
- &src->where);
+ gfc_warning (w, "Non-zero imaginary part discarded "
+ "in conversion from %qs to %qs at %L",
+ gfc_typename(&src->ts), gfc_typename (&result->ts),
+ &src->where);
did_warn = true;
}
! { dg-do compile }
! { dg-options "-Wconversion" }
! PR 78221 - used to give a spurious warning
complex, parameter :: i = (0.,1.)
complex :: t
t = (i)
end