Hi!

On 2019-08-16T17:31:36+0300, Janne Blomqvist <blomqvist.ja...@gmail.com> wrote:
> Improve the error message that is printed when a memory allocation
> fails, by including the location, and the size of the allocation that
> failed.

>       * runtime/error.c (os_error_at): New function.

Committed the attached in r276691 to "Extend
'libgfortran/runtime/minimal.c' per r274599 "PR fortran/68401 Improve
allocation error message"".


Grüße
 Thomas


From 19c0ab5ba623bfe5926f3be04306399f9fc8dd8e Mon Sep 17 00:00:00 2001
From: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue, 8 Oct 2019 10:20:41 +0000
Subject: [PATCH 2/3] Extend 'libgfortran/runtime/minimal.c' per r274599 "PR
 fortran/68401 Improve allocation error message"

	libgfortran/
	PR fortran/68401
	* runtime/minimal.c (os_error_at): New function.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@276691 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgfortran/ChangeLog         |  3 +++
 libgfortran/runtime/minimal.c | 23 ++++++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 9e3b1f8bad8..c5a45333042 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,5 +1,8 @@
 2019-10-08  Thomas Schwinge  <tho...@codesourcery.com>
 
+	PR fortran/68401
+        * runtime/minimal.c (os_error_at): New function.
+
 	* runtime/minimal.c: Revise.
 
 2019-10-05  Paul Thomas  <pa...@gcc.gnu.org>
diff --git a/libgfortran/runtime/minimal.c b/libgfortran/runtime/minimal.c
index a633bc1ce0f..bdaf878ffcb 100644
--- a/libgfortran/runtime/minimal.c
+++ b/libgfortran/runtime/minimal.c
@@ -215,7 +215,28 @@ os_error (const char *message)
   estr_write ("\n");
   exit_error (1);
 }
-iexport(os_error);
+iexport(os_error); /* TODO, DEPRECATED, ABI: Should not be exported
+		      anymore when bumping so version.  */
+
+
+/* Improved version of os_error with a printf style format string and
+   a locus.  */
+
+void
+os_error_at (const char *where, const char *message, ...)
+{
+  va_list ap;
+
+  recursion_check ();
+  estr_write (where);
+  estr_write (": ");
+  va_start (ap, message);
+  estr_vprintf (message, ap);
+  va_end (ap);
+  estr_write ("\n");
+  exit_error (1);
+}
+iexport(os_error_at);
 
 
 /* void runtime_error()-- These are errors associated with an
-- 
2.17.1

Attachment: signature.asc
Description: PGP signature

Reply via email to