aboutsummaryrefslogtreecommitdiff
path: root/gcc
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
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')
-rw-r--r--gcc/fortran/ChangeLog10
-rw-r--r--gcc/fortran/arith.c2
-rw-r--r--gcc/fortran/expr.c17
-rw-r--r--gcc/fortran/gfortran.h2
-rw-r--r--gcc/fortran/iresolve.c4
-rw-r--r--gcc/fortran/resolve.c4
6 files changed, 25 insertions, 14 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 7000e25..21c6154 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,13 @@
+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
diff --git a/gcc/fortran/arith.c b/gcc/fortran/arith.c
index d119d12..674b246 100644
--- a/gcc/fortran/arith.c
+++ b/gcc/fortran/arith.c
@@ -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
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;
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 340e014..9ea5ad1 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -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 *);
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c
index 1f8f9bc..e2089b2 100644
--- a/gcc/fortran/iresolve.c
+++ b/gcc/fortran/iresolve.c
@@ -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;
}
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 8d2be53..00bd441 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -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;