PR 39654 FTELL intrinsic function return type.
authorJanne Blomqvist <jb@gcc.gnu.org>
Thu, 21 Jun 2012 18:47:01 +0000 (21:47 +0300)
committerJanne Blomqvist <jb@gcc.gnu.org>
Thu, 21 Jun 2012 18:47:01 +0000 (21:47 +0300)
frontend ChangeLog:

2012-06-21  Janne Blomqvist  <jb@gcc.gnu.org>

PR fortran/39654
* iresolve.c (gfc_resolve_ftell): Fix result kind and use new
library function.

library ChangeLog:

2012-06-21  Janne Blomqvist  <jb@gcc.gnu.org>

PR fortran/39654
* io/intrinsics.c (ftell2): New function.
* gfortran.map (_gfortran_ftell2): Export function.

From-SVN: r188858

gcc/fortran/ChangeLog
gcc/fortran/iresolve.c
libgfortran/ChangeLog
libgfortran/gfortran.map
libgfortran/io/intrinsics.c

index ef2dc36166b12e3530895757f62b4245b26f85d6..f3265721de8c7b84993845b86526176231174bea 100644 (file)
@@ -1,3 +1,9 @@
+2012-06-21  Janne Blomqvist  <jb@gcc.gnu.org>
+
+       PR fortran/39654
+       * iresolve.c (gfc_resolve_ftell): Fix result kind and use new
+       library function.
+
 2012-06-18  Tobias Burnus  <burnus@net-b.de>
 
        * intrinsic.h (gfc_resolve_rank): New prototype.
index 2a494550bbc8e88b99845c433dd627f5908e969c..6d1e8b2a1766e9263b3556b08d31964e2130d194 100644 (file)
@@ -2480,7 +2480,7 @@ gfc_resolve_ftell (gfc_expr *f, gfc_expr *u)
   gfc_clear_ts (&ts);
 
   f->ts.type = BT_INTEGER;
-  f->ts.kind = gfc_index_integer_kind;
+  f->ts.kind = gfc_intio_kind;
   if (u->ts.kind != gfc_c_int_kind)
     {
       ts.type = BT_INTEGER;
@@ -2490,7 +2490,7 @@ gfc_resolve_ftell (gfc_expr *f, gfc_expr *u)
       gfc_convert_type (u, &ts, 2);
     }
 
-  f->value.function.name = gfc_get_string (PREFIX ("ftell"));
+  f->value.function.name = gfc_get_string (PREFIX ("ftell2"));
 }
 
 
index 6f204f14769546ac279c111182dcc937972bd189..96a8e8ba42af46fe4b47be1e2dbafd87c49b05b9 100644 (file)
@@ -1,3 +1,9 @@
+2012-06-21  Janne Blomqvist  <jb@gcc.gnu.org>
+
+       PR fortran/39654
+       * io/intrinsics.c (ftell2): New function.
+       * gfortran.map (_gfortran_ftell2): Export function.
+
 2012-06-04  Robert Mason  <rbmj@verizon.net>
            Janne Blomqvist  <jb@gcc.gnu.org>
 
index 211db00cd1087d3749a9cf663080a70f143502c1..217d2a3cf51a76966617ade0aabd945227f98a14 100644 (file)
@@ -1189,6 +1189,11 @@ GFORTRAN_1.4 {
     _gfortran_eoshift2_16_char4;
 } GFORTRAN_1.3; 
 
+GFORTRAN_1.5 {
+  global:
+    _gfortran_ftell2;
+} GFORTRAN_1.4; 
+
 F2C_1.0 {
   global:
     _gfortran_f2c_specific__abs_c4;
index 576434a8e4c0cf44d96d51817ae43b3d5f854f73..9abadae43739583eb1a69b0a54b49e33fbf3c429 100644 (file)
@@ -272,6 +272,10 @@ gf_ftell (int unit)
   return ret;
 }
 
+
+/* Here is the ftell function with an incorrect return type; retained
+   due to ABI compatibility.  */
+
 extern size_t PREFIX(ftell) (int *);
 export_proto_np(PREFIX(ftell));
 
@@ -281,6 +285,22 @@ PREFIX(ftell) (int * unit)
   return gf_ftell (*unit);
 }
 
+
+/* Here is the ftell function with the correct return type, ensuring
+   that large files can be supported as long as the target supports
+   large integers; as of 4.8 the FTELL intrinsic function will call
+   this one instead of the old ftell above.  */
+
+extern GFC_IO_INT PREFIX(ftell2) (int *);
+export_proto_np(PREFIX(ftell2));
+
+GFC_IO_INT
+PREFIX(ftell2) (int * unit)
+{
+  return gf_ftell (*unit);
+}
+
+
 #define FTELL_SUB(kind) \
   extern void ftell_i ## kind ## _sub (int *, GFC_INTEGER_ ## kind *); \
   export_proto(ftell_i ## kind ## _sub); \