aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/iresolve.c
diff options
context:
space:
mode:
authorSteven G. Kargl <kargls@comcast.net>2004-12-12 21:09:09 +0000
committerPaul Brook <pbrook@gcc.gnu.org>2004-12-12 21:09:09 +0000
commitc3d003d207ac27d639e18010dae6b7087ead1beb (patch)
tree45e9b6e52d2737fdf74257a64276a9514252ce15 /gcc/fortran/iresolve.c
parent0736fd563fa409b16f4cf1c3a7e4c42051f8c6dc (diff)
downloadgcc-c3d003d207ac27d639e18010dae6b7087ead1beb.zip
gcc-c3d003d207ac27d639e18010dae6b7087ead1beb.tar.gz
gcc-c3d003d207ac27d639e18010dae6b7087ead1beb.tar.bz2
re PR fortran/16581 (gfortran F90 bit intrinsics don't work with integer*{1,2,8})
2004-12-12 Steven G. Kargl <kargls@comcast.net> PR fortran/16581 * check.c (gfc_check_iand, gfc_check_ibclr, gfc_check_ibits, gfc_check_ibset, gfc_check_ieor, gfc_check_ior): Remove default integer kind check; Issue error for -std=f95 when needed. * intrinsic.c (add_functions): Change ieor from GFC_STD_GNU to GFC_STD_F95. * iresolve.c (gfc_resolve_iand, gfc_resolve_ieor, gfc_resolve_ior): Promote arguments to same kind. From-SVN: r92063
Diffstat (limited to 'gcc/fortran/iresolve.c')
-rw-r--r--gcc/fortran/iresolve.c38
1 files changed, 33 insertions, 5 deletions
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c
index 7a46028..d942fdd 100644
--- a/gcc/fortran/iresolve.c
+++ b/gcc/fortran/iresolve.c
@@ -619,8 +619,18 @@ gfc_resolve_getuid (gfc_expr * f)
}
void
-gfc_resolve_iand (gfc_expr * f, gfc_expr * i, gfc_expr * j ATTRIBUTE_UNUSED)
+gfc_resolve_iand (gfc_expr * f, gfc_expr * i, gfc_expr * j)
{
+ /* If the kind of i and j are different, then g77 cross-promoted the
+ kinds to the largest value. The Fortran 95 standard requires the
+ kinds to match. */
+ if (i->ts.kind != j->ts.kind)
+ {
+ if (i->ts.kind == gfc_kind_max (i,j))
+ gfc_convert_type(j, &i->ts, 2);
+ else
+ gfc_convert_type(i, &j->ts, 2);
+ }
f->ts = i->ts;
f->value.function.name = gfc_get_string ("__iand_%d", i->ts.kind);
@@ -676,9 +686,18 @@ gfc_resolve_idnint (gfc_expr * f, gfc_expr * a)
void
-gfc_resolve_ieor (gfc_expr * f, gfc_expr * i,
- gfc_expr * j ATTRIBUTE_UNUSED)
+gfc_resolve_ieor (gfc_expr * f, gfc_expr * i, gfc_expr * j)
{
+ /* If the kind of i and j are different, then g77 cross-promoted the
+ kinds to the largest value. The Fortran 95 standard requires the
+ kinds to match. */
+ if (i->ts.kind != j->ts.kind)
+ {
+ if (i->ts.kind == gfc_kind_max (i,j))
+ gfc_convert_type(j, &i->ts, 2);
+ else
+ gfc_convert_type(i, &j->ts, 2);
+ }
f->ts = i->ts;
f->value.function.name = gfc_get_string ("__ieor_%d", i->ts.kind);
@@ -686,9 +705,18 @@ gfc_resolve_ieor (gfc_expr * f, gfc_expr * i,
void
-gfc_resolve_ior (gfc_expr * f, gfc_expr * i,
- gfc_expr * j ATTRIBUTE_UNUSED)
+gfc_resolve_ior (gfc_expr * f, gfc_expr * i, gfc_expr * j)
{
+ /* If the kind of i and j are different, then g77 cross-promoted the
+ kinds to the largest value. The Fortran 95 standard requires the
+ kinds to match. */
+ if (i->ts.kind != j->ts.kind)
+ {
+ if (i->ts.kind == gfc_kind_max (i,j))
+ gfc_convert_type(j, &i->ts, 2);
+ else
+ gfc_convert_type(i, &j->ts, 2);
+ }
f->ts = i->ts;
f->value.function.name = gfc_get_string ("__ior_%d", i->ts.kind);