aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/expr.c
diff options
context:
space:
mode:
authorDaniel Franke <franke.daniel@gmail.com>2009-12-11 16:08:39 -0500
committerDaniel Franke <dfranke@gcc.gnu.org>2009-12-11 16:08:39 -0500
commitdcea1b2f86047a9b234fb742bdb3ce268262dfa7 (patch)
tree3c1409b090284617f01f8d1a0ed5716730972e99 /gcc/fortran/expr.c
parent77cb940117db0b1873ccb4587b74499a0c1c4b73 (diff)
downloadgcc-dcea1b2f86047a9b234fb742bdb3ce268262dfa7.zip
gcc-dcea1b2f86047a9b234fb742bdb3ce268262dfa7.tar.gz
gcc-dcea1b2f86047a9b234fb742bdb3ce268262dfa7.tar.bz2
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
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r--gcc/fortran/expr.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index f0cfd18..35918a6 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -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;