[patch, libfortran] PR 32858 - printf()-capabilities for runtime_error

Thomas Koenig tkoenig@alice-dsl.net
Sun Jul 29 18:53:00 GMT 2007


:ADDPATCH fortran:

Hello world,

this patch allows gfortran's internal runtime_error()
function to take on printf-style arguments, in order to
report additional information to the user.  One example
is included, reporting the extents for a bounds-check error
for PR 30814.

With this patch in place, we should be able to generate more
useful diagnostics, especially for bounds-check errors.

It also removes the st_sprintf function, which used to implement
a subset of sprintf's capabilities, and replaces it with
sprintf.

Successfully bootstrapped on a recent trunk on i686-pc-linux-gnu.
Currently regression-testing.  OK for trunk if this passes?

	Thomas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-3
Type: text/x-patch
Size: 32449 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070729/cce6b4dd/attachment.bin>
-------------- next part --------------
2007-07-29  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR libfortran/32858
	PR libfortran/30814
	* configure.ac:  Added checks for presence of stdio.h and
	stdarg.h.  Test presence of vsnprintf().
	* configure: Regenerated.
	* config.h.in:  Regenerated.
	* libgfortran.h:  Include <stdio.h>.  Add printf attribute to
	prototype of runtime_error.  Remove prototype for st_sprintf.
	Add prototype for st_vprintf.
	* runtime/main.c (store_exec_path):  Replace st_sprintf by sprintf.
	* runtime/error.c (st_sprintf):  Remove.
	(runtime_error):  Rewrite as a variadic function.  Call
	st_vprintf().
	* intrinsics/pack_generic.c:  Output extents of LHS and RHS for
	bounds error.
	* io/open.c (new_unit):  Replace st_sprintf by sprintf.
	* io/list_read.c (convert_integer):  Likewise.
	(parse_repeat):  Likewise.
	(read_logical):  Likewise.
	(read_character):  Likewise.
	(parse_real):  Likewise.
	(read_real):  Likewise.
	(check_type):  Likewise.
	(nml_parse_qualifyer):  Likewise.
	(nml_read_obj):  Likewise.
	(nml_get_ojb_data):  Likewise.
	* io/unix.c (init_error_stream):  Remove.
	(tempfile):  Replace st_sprintf by sprintf.
	(st_vprintf):  New function.
	(st_printf):  Rewrite to call st_vprintf.
	* io/transfer.c (require_type):  Replace st_sprintf by sprintf.
	* io/format.c (format_error):  Likewise.
	* io/write.c (nml_write_obj):  Likewise.

2007-07-29  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR libfortran/32858
	PR libfortran/30814
	* gfortran.dg/pack_bounds_1.f90:  Adjust to new error message.


More information about the Fortran mailing list