Commit dcea1b2f by Daniel Franke Committed by Daniel Franke

re PR fortran/40290 (Spurious warning on REAL*COMPLEX with -Wconversion)

2009-12-11  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/40290
        * expr.c (gfc_type_convert_binary): Added warn-on-conversion flag,
        passed on to gfc_convert_type_warn() instead of gfc_convert_type();
        enabled warnings on all callers but ...
        * arith.c (eval_intrinsic): Disabled warnings on implicit type
        conversion.
        * gfortran.h gfc_type_convert_binary): Adjusted prototype.

From-SVN: r155179
parent 77cb9401
2009-12-11 Daniel Franke <franke.daniel@gmail.com>
PR fortran/40290
* expr.c (gfc_type_convert_binary): Added warn-on-conversion flag,
passed on to gfc_convert_type_warn() instead of gfc_convert_type();
enabled warnings on all callers but ...
* arith.c (eval_intrinsic): Disabled warnings on implicit type
conversion.
* gfortran.h gfc_type_convert_binary): Adjusted prototype.
2009-12-11 Janus Weil <janus@gcc.gnu.org>
PR fortran/42335
......
......@@ -1577,7 +1577,7 @@ eval_intrinsic (gfc_intrinsic_op op,
temp.value.op.op1 = op1;
temp.value.op.op2 = op2;
gfc_type_convert_binary (&temp);
gfc_type_convert_binary (&temp, 0);
if (op == INTRINSIC_EQ || op == INTRINSIC_NE
|| op == INTRINSIC_GE || op == INTRINSIC_GT
......
......@@ -653,7 +653,8 @@ gfc_build_conversion (gfc_expr *e)
/* Given an expression node with some sort of numeric binary
expression, insert type conversions required to make the operands
have the same type.
have the same type. Conversion warnings are disabled if wconversion
is set to 0.
The exception is that the operands of an exponential don't have to
have the same type. If possible, the base is promoted to the type
......@@ -661,7 +662,7 @@ gfc_build_conversion (gfc_expr *e)
1.0**2 stays as it is. */
void
gfc_type_convert_binary (gfc_expr *e)
gfc_type_convert_binary (gfc_expr *e, int wconversion)
{
gfc_expr *op1, *op2;
......@@ -685,9 +686,9 @@ gfc_type_convert_binary (gfc_expr *e)
}
if (op1->ts.kind > op2->ts.kind)
gfc_convert_type (op2, &op1->ts, 2);
gfc_convert_type_warn (op2, &op1->ts, 2, wconversion);
else
gfc_convert_type (op1, &op2->ts, 2);
gfc_convert_type_warn (op1, &op2->ts, 2, wconversion);
e->ts = op1->ts;
goto done;
......@@ -702,14 +703,14 @@ gfc_type_convert_binary (gfc_expr *e)
if (e->value.op.op == INTRINSIC_POWER)
goto done;
gfc_convert_type (e->value.op.op2, &e->ts, 2);
gfc_convert_type_warn (e->value.op.op2, &e->ts, 2, wconversion);
goto done;
}
if (op1->ts.type == BT_INTEGER)
{
e->ts = op2->ts;
gfc_convert_type (e->value.op.op1, &e->ts, 2);
gfc_convert_type_warn (e->value.op.op1, &e->ts, 2, wconversion);
goto done;
}
......@@ -720,9 +721,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, wconversion);
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, wconversion);
done:
return;
......
......@@ -2588,7 +2588,7 @@ bool is_subref_array (gfc_expr *);
void gfc_add_component_ref (gfc_expr *, const char *);
gfc_expr *gfc_build_conversion (gfc_expr *);
void gfc_free_ref_list (gfc_ref *);
void gfc_type_convert_binary (gfc_expr *);
void gfc_type_convert_binary (gfc_expr *, int);
int gfc_is_constant_expr (gfc_expr *);
gfc_try gfc_simplify_expr (gfc_expr *, int);
int gfc_has_vector_index (gfc_expr *);
......
......@@ -702,7 +702,7 @@ gfc_resolve_dot_product (gfc_expr *f, gfc_expr *a, gfc_expr *b)
temp.value.op.op = INTRINSIC_NONE;
temp.value.op.op1 = a;
temp.value.op.op2 = b;
gfc_type_convert_binary (&temp);
gfc_type_convert_binary (&temp, 1);
f->ts = temp.ts;
f->value.function.name
= gfc_get_string (PREFIX ("dot_product_%c%d"),
......@@ -1380,7 +1380,7 @@ gfc_resolve_matmul (gfc_expr *f, gfc_expr *a, gfc_expr *b)
temp.value.op.op = INTRINSIC_NONE;
temp.value.op.op1 = a;
temp.value.op.op2 = b;
gfc_type_convert_binary (&temp);
gfc_type_convert_binary (&temp, 1);
f->ts = temp.ts;
}
......
......@@ -3320,7 +3320,7 @@ resolve_operator (gfc_expr *e)
case INTRINSIC_POWER:
if (gfc_numeric_ts (&op1->ts) && gfc_numeric_ts (&op2->ts))
{
gfc_type_convert_binary (e);
gfc_type_convert_binary (e, 1);
break;
}
......@@ -3407,7 +3407,7 @@ resolve_operator (gfc_expr *e)
if (gfc_numeric_ts (&op1->ts) && gfc_numeric_ts (&op2->ts))
{
gfc_type_convert_binary (e);
gfc_type_convert_binary (e, 1);
e->ts.type = BT_LOGICAL;
e->ts.kind = gfc_default_logical_kind;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment