aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/simplify.c
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2005-06-01 19:17:37 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2005-06-01 19:17:37 +0000
commitc3a29423de8cfb7e2b5642b9d44eb21e4b286aec (patch)
treeaca5715d2e2402e23f8d6fcb8a69bdb7516dab2e /gcc/fortran/simplify.c
parentcdeee6d28017c9c881d2395645b3314fa575e59b (diff)
downloadgcc-c3a29423de8cfb7e2b5642b9d44eb21e4b286aec.zip
gcc-c3a29423de8cfb7e2b5642b9d44eb21e4b286aec.tar.gz
gcc-c3a29423de8cfb7e2b5642b9d44eb21e4b286aec.tar.bz2
intrinsic.c (add_conv): No longer take a "simplify" argument as its always gfc_convert_constant...
* intrinsic.c (add_conv): No longer take a "simplify" argument as its always gfc_convert_constant, instead take a "standard" argument. (add_conversions): Change all existing calls of add_conv to pass GFC_STD_F77 as appropriate. Additionally, if we're allowing GNU extensions support integer-logical and logical-integer conversions. (gfc_convert_type_warn): Warn about use the use of these conversions as a extension when appropriate, i.e. with -pedantic. * simplify.c (gfc_convert_constant): Add support for integer to logical and logical to integer conversions, using gfc_int2log and gfc_log2int. * arith.c (gfc_log2int, gfc_int2log): New functions. * arith.h (gfc_log2int, gfc_int2log): Prototype here. * gfortran.texi: Document this new GNU extension. * gfortran.dg/logint-1.f: New test case. * gfortran.dg/logint-2.f: Likewise. * gfortran.dg/logint-3.f: Likewise. From-SVN: r100461
Diffstat (limited to 'gcc/fortran/simplify.c')
-rw-r--r--gcc/fortran/simplify.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index fa6c2c6..6797bca 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -3659,6 +3659,9 @@ gfc_convert_constant (gfc_expr * e, bt type, int kind)
case BT_COMPLEX:
f = gfc_int2complex;
break;
+ case BT_LOGICAL:
+ f = gfc_int2log;
+ break;
default:
goto oops;
}
@@ -3700,9 +3703,17 @@ gfc_convert_constant (gfc_expr * e, bt type, int kind)
break;
case BT_LOGICAL:
- if (type != BT_LOGICAL)
- goto oops;
- f = gfc_log2log;
+ switch (type)
+ {
+ case BT_INTEGER:
+ f = gfc_log2int;
+ break;
+ case BT_LOGICAL:
+ f = gfc_log2log;
+ break;
+ default:
+ goto oops;
+ }
break;
default: