diff options
author | Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2007-07-14 23:11:04 +0000 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2007-07-14 23:11:04 +0000 |
commit | 37058415033503179d69f4d58e08dddae0a44142 (patch) | |
tree | cb6072d1b22add852e30552e5ec23a6e5ded7c79 /gcc/fortran/iresolve.c | |
parent | 00f46785eb6b0fd29997e5fe5756e9ef141a1b11 (diff) | |
download | gcc-37058415033503179d69f4d58e08dddae0a44142.zip gcc-37058415033503179d69f4d58e08dddae0a44142.tar.gz gcc-37058415033503179d69f4d58e08dddae0a44142.tar.bz2 |
re PR fortran/32357 (MVBITS gives wrong-code on big-endian with -fdefault-integer-8)
PR fortran/32357
* iresolve.c (gfc_resolve_mvbits): Convert FROMPOS, LEN and TOPOS
to C int.
* intrinsics/mvbits.c: Change prototype so that FROMPOS, LEN and
TOPOS arguments are C int.
* gfortran.dg/mvbits_2.f90: New test.
From-SVN: r126646
Diffstat (limited to 'gcc/fortran/iresolve.c')
-rw-r--r-- | gcc/fortran/iresolve.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c index 66a3c2f..22de74d 100644 --- a/gcc/fortran/iresolve.c +++ b/gcc/fortran/iresolve.c @@ -2443,9 +2443,22 @@ void gfc_resolve_mvbits (gfc_code *c) { const char *name; - int kind; - kind = c->ext.actual->expr->ts.kind; - name = gfc_get_string (PREFIX ("mvbits_i%d"), kind); + gfc_typespec ts; + + /* FROMPOS, LEN and TOPOS are restricted to small values. As such, + they will be converted so that they fit into a C int. */ + ts.type = BT_INTEGER; + ts.kind = gfc_c_int_kind; + if (c->ext.actual->next->expr->ts.kind != gfc_c_int_kind) + gfc_convert_type (c->ext.actual->next->expr, &ts, 2); + if (c->ext.actual->next->next->expr->ts.kind != gfc_c_int_kind) + gfc_convert_type (c->ext.actual->next->next->expr, &ts, 2); + if (c->ext.actual->next->next->next->next->expr->ts.kind != gfc_c_int_kind) + gfc_convert_type (c->ext.actual->next->next->next->next->expr, &ts, 2); + + /* TO and FROM are guaranteed to have the same kind parameter. */ + name = gfc_get_string (PREFIX ("mvbits_i%d"), + c->ext.actual->expr->ts.kind); c->resolved_sym = gfc_get_intrinsic_sub_symbol (name); } |