Fallout from -fdefault-integer-8

Steve Kargl sgk@troutmask.apl.washington.edu
Fri Aug 3 04:58:00 GMT 2007


Well, I determined the nature of the problems found
by Dominique with spacing() and rrspacing().  Unfortunately,
the problem may be propagated to many runtime library
routines.  Specificly, for rrspacing() we need

@@ -1742,6 +1742,13 @@
   prec = gfc_get_actual_arglist ();
   prec->name = "p";
   prec->expr = gfc_int_expr (gfc_real_kinds[k].digits);
+  if (prec->expr->ts.kind != 4)
+    {
+      gfc_typespec ts;
+      ts.type = BT_INTEGER;
+      ts.kind = 4;
+      gfc_convert_type (prec->expr, &ts, 2);
+    }
   f->value.function.actual->next = prec;
 }

Well, it just so happens that gfc_resolve_scale() is nearby and
I noticed

  /* The implementation calls scalbn which takes an int as the
     second argument.  */
  if (i->ts.kind != gfc_c_int_kind)
    {
      gfc_typespec ts;
      ts.type = BT_INTEGER;
      ts.kind = gfc_default_integer_kind;
      gfc_convert_type_warn (i, &ts, 2, 0);
    }

In the context of -fdefault-integer-8, the above is a bug.  I
think we'll need to audit all uses of 

      ts.kind = gfc_default_integer_kind;

to determine if it is used correctly.

-- 
Steve



More information about the Fortran mailing list