This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[fortran, patch] Remove parentheses and comma in error message.


Hello,

This patch removes the "(   ,  )" in the error message function
gfc_trans_runtime_check().
This is used by the array checks (bounding error, strides) and for the 
format-label errors; it also will be used by the substring check (review
pending).

This change was suggested by Steve; I also prefer it to the current version.

Old/current error message (example):
---------------
Fortran runtime error: Array reference out of bounds for array 'a',
upper bound of dimension 1 exceeded (in file 'string2.f90' at line 6)
---------------

New/proposed error message (example):
---------------
Fortran runtime error: Array reference out of bounds for array 'a',
upper bound of dimension 1 exceeded in file 'string2.f90' at line 6
---------------

All the testcases, I found, use something like
"upper bound of dimension 1 exceeded.*at line 6" and are thus not
affected by this patch.

Tobias
Index: gcc/fortran/trans.c
===================================================================
*** gcc/fortran/trans.c	(Revision 117449)
--- gcc/fortran/trans.c	(Arbeitskopie)
*************** gfc_trans_runtime_check (tree cond, cons
*** 329,339 ****
  #else 
        line = where->lb->linenum;
  #endif
!       asprintf (&message, "%s (in file '%s', at line %d)", _(msgid),
  		where->lb->file->filename, line);
      }
    else
!     asprintf (&message, "%s (in file '%s', around line %d)", _(msgid),
  	      gfc_source_file, input_line + 1);
  
    tmp = gfc_build_addr_expr (pchar_type_node, gfc_build_cstring_const(message));
--- 329,339 ----
  #else 
        line = where->lb->linenum;
  #endif
!       asprintf (&message, "%s in file '%s' at line %d", _(msgid),
  		where->lb->file->filename, line);
      }
    else
!     asprintf (&message, "%s in file '%s' around line %d", _(msgid),
  	      gfc_source_file, input_line + 1);
  
    tmp = gfc_build_addr_expr (pchar_type_node, gfc_build_cstring_const(message));

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]