Hi Janus,

Janus Weil wrote:
In addition to this, the patch contains a part which concerns the
function 'gfc_terminal_width': Currently this returns a fixed value of
80, which means that all source lines are trimmed to 80 characters in
the error messages. I increased this default value to 132 (in order to
accommodate standard free-format lines), and added a part which tries
to determine the terminal width from the environment variable $COLUMNS
(the corresponding code was borrowed from gcc/opts.c).

I think it is a good idea to use $COLUMNS (which is, e.g. set by the shell under Unix); however, if the variable is not available, I think one should keep the value 80.

2013-05-30  Janus Weil<ja...@gcc.gnu.org>

     PR fortran/57217
     * gfortran. h (gfc_terminal_width): Remove prototype.
Spurious space before "h".

-/* Given two symbols that are formal arguments, compare their ranks
-   and types.  Returns nonzero if they have the same rank and type,
-   zero otherwise.  */
+static int
+compare_type (gfc_symbol *s1, gfc_symbol *s2)
+{
+  if (s1->attr.ext_attr & (1 << EXT_ATTR_NO_ARG_CHECK)
+      || s2->attr.ext_attr & (1 << EXT_ATTR_NO_ARG_CHECK))
+    return 1;
+ return gfc_compare_types (&s1->ts, &s2->ts)
+        || s1->ts.type == BT_ASSUMED || s2->ts.type == BT_ASSUMED;
+}

I admit it is a slightly different issue, but it came up in the same thread: I believe it should be:

+  if (s2->attr.ext_attr & (1 << EXT_ATTR_NO_ARG_CHECK))
+    return 1;
...
+  return s2->ts.type == BT_ASSUMED || gfc_compare_types (&s1->ts, &s2->ts);


That should fix the issue with the two of the three test cases at http://gcc.gnu.org/ml/fortran/2013-05/msg00089.html

-compare_type_rank (gfc_symbol *s1, gfc_symbol *s2)
+compare_rank (gfc_symbol *s1, gfc_symbol *s2)
  {
    gfc_array_spec *as1, *as2;
    int r1, r2;
@@ -533,11 +541,21 @@ static int
        && (!as2 || as2->type != AS_ASSUMED_RANK))
      return 0;                 /* Ranks differ.  */

Ditto here:
  if (r1 != r2
      && (!as1 || as1->type != AS_ASSUMED_RANK)
      && (!as2 || as2->type != AS_ASSUMED_RANK))
    return 0;                   /* Ranks differ.  */

where the "!as1" line should be removed, which fixes the third of the three test cases of the email mentioned above.


Otherwise, the patch looks okay.

I'd like if you could include the mentioned changes to the type/rank checks together with the three test cases. But as strictly speaking those are about separate issues, one could also do it in a follow up patch.



Regarding the error printing: My long standing wish is to ignore ignore trailing comments when trimming the error message, i.e. instead of printing

e" ! some very long comment line

one should rather show

print *, some "line" ! some ver

where one cuts of the comment line. I think the issue mostly occurs with %C error printing where the current location is at the end of the line, while for %L the location should be fine.

Tobias

PS: If you have time, please have a look at my patch at http://gcc.gnu.org/ml/fortran/2013-05/msg00118.html - as I just saw, I managed again to attach the wrong patch. That patch also includes the gcc/fortran bits of http://gcc.gnu.org/ml/fortran/2013-05/msg00114.html , which also still has to be reviewed.

Reply via email to