re PR fortran/78221 (bogus warning: Non-zero imaginary part discarded in conversion...
authorThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 6 Nov 2016 12:27:51 +0000 (12:27 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 6 Nov 2016 12:27:51 +0000 (12:27 +0000)
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.

From-SVN: r241884

gcc/fortran/ChangeLog
gcc/fortran/arith.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/warn_conversion_9.f90 [new file with mode: 0644]

index 41225b55650364a425f9053964f71a29f70628a3..5c25988c026ddc57a234983e5bd865f31f5ced2b 100644 (file)
@@ -1,3 +1,9 @@
+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-05  Paul Thomas  <pault@gcc.gnu.org>
 
        * check.c (gfc_check_move_alloc): Introduce error to prevent
index d566faa29cd889870ba02537e0764f7a7a5f6a11..2781f1038413bfb8aabc53e04c51f20e24ab99d3 100644 (file)
@@ -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;
        }
 
index 69af2ef70253352ccee33640ff280b4b2d25931b..f6bdc414fedf035d8612fd7e16503dc8bf705169 100644 (file)
@@ -1,3 +1,9 @@
+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-05  Paul Thomas  <pault@gcc.gnu.org>
 
        * gfortran.dg/move_alloc_17.f03: New test.
diff --git a/gcc/testsuite/gfortran.dg/warn_conversion_9.f90 b/gcc/testsuite/gfortran.dg/warn_conversion_9.f90
new file mode 100644 (file)
index 0000000..794eeef
--- /dev/null
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! { dg-options "-Wconversion" }
+! PR 78221 - used to give a spurious warning
+complex, parameter :: i = (0.,1.)
+complex :: t
+t = (i)
+end