------- Comment #2 from dfranke at gcc dot gnu dot org  2009-12-11 18:56 -------
Using "-O3 -fno-signed-zeros" (the latter being set by -ffast-math) gets rid of
all the additional computations and results in

<bb 2>:
  D.1504_2 = *a_1(D);
  D.1514_10 = REALPART_EXPR <*b_4(D)>;
  D.1515_11 = IMAGPART_EXPR <*b_4(D)>;
  D.1516_12 = D.1504_2 * D.1514_10;
  D.1517_13 = D.1504_2 * D.1515_11;
  __result_op.0_6 = COMPLEX_EXPR <D.1516_12, D.1517_13>;
  return __result_op.0_6;


With the patch below, the warning would be disabled. However is this warning a
feature (then keep it), or an artefact of an implementation detail (then remove
it)?

Index: expr.c
===================================================================
--- expr.c      (revision 155148)
+++ expr.c      (working copy)
@@ -720,9 +720,9 @@ gfc_type_convert_binary (gfc_expr *e)
   else
     e->ts.kind = op2->ts.kind;
   if (op1->ts.type != BT_COMPLEX || op1->ts.kind != e->ts.kind)
-    gfc_convert_type (e->value.op.op1, &e->ts, 2);
+    gfc_convert_type_warn (e->value.op.op1, &e->ts, 2, 0);
   if (op2->ts.type != BT_COMPLEX || op2->ts.kind != e->ts.kind)
-    gfc_convert_type (e->value.op.op2, &e->ts, 2);
+    gfc_convert_type_warn (e->value.op.op2, &e->ts, 2, 0);

 done:
   return;


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|missed-optimization         |
      Known to fail|4.5.0                       |
            Summary|Bogus conversion of         |Spurious warning on
                   |REAL*COMPLEX to             |REAL*COMPLEX with -
                   |COMPLEX*COMPLEX             |Wconversion


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

Reply via email to