From patchwork Wed Mar 11 21:48:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 449207 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0F61D14015A for ; Thu, 12 Mar 2015 08:48:42 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=L5TTVqvl; dkim-adsp=none (unprotected policy); dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; q=dns; s=default; b=cZHqXGp4p536Hf7B 7NNV0sYGBBOIeZu/kaUdXk5CjyGa4kvP/UN24f+QhHhshe1G90NbfiZCY8jD3+d4 H222gz7XlnNOOotJm16WgxKvo1KP4OdNiZLeOZC0yfqBnysu7H57jNG6vBf5WxXG JNagfNJj5M9yWgYTZd6vriPVm34= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=default; bh=KWgi383b5GYpYaHDjBSd9e Bx9qE=; b=L5TTVqvl54xHIcBzTDVmFDvE6DC2HZIIishOO1AzXQV7PWEUnBY+Cb S3QWYXzxlrv8xsA7C0wwggpSAXFZgQg/ULELn9Kq+6INzMB9GY/3g0QuBPhTqhw/ HDG7j7GgLrejOECD4mtDy9TQgICBl+hSJqaVWGTeStkGPDNBLWRqA= Received: (qmail 99629 invoked by alias); 11 Mar 2015 21:48:35 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 99611 invoked by uid 89); 11 Mar 2015 21:48:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 11 Mar 2015 21:48:33 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1YVoUQ-0002Ce-Bz from Thomas_Schwinge@mentor.com ; Wed, 11 Mar 2015 14:48:30 -0700 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Wed, 11 Mar 2015 21:48:28 +0000 From: Thomas Schwinge To: , CC: Bernd Schmidt Subject: Re: RFC: Building a minimal libgfortran for nvptx In-Reply-To: <54663710.7070405@codesourcery.com> References: <5458E403.4010408@codesourcery.com> <54652AF7.1010703@net-b.de> <54663710.7070405@codesourcery.com> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) Date: Wed, 11 Mar 2015 22:48:22 +0100 Message-ID: <87oanz5hp5.fsf@kepler.schwinge.homeip.net> MIME-Version: 1.0 Hi! On Fri, 14 Nov 2014 18:08:32 +0100, Bernd Schmidt wrote: > New patch below, [...] ... got committed. I now committed the following in r221363: commit 83ba0e65833dd081db921f8c2b3277316590753c Author: tschwinge Date: Wed Mar 11 21:42:56 2015 +0000 libgfortran LIBGFOR_MINIMAL enhancements. Based on GCC trunk r220892, for nvptx-none: === gfortran Summary === # of expected passes [-31320-]{+32117+} # of unexpected failures [-7222-]{+6821+} # of expected failures 78 # of unresolved testcases [-6441-]{+6158+} # of untested testcases [-432-]{+391+} # of unsupported tests 639 libgfortran/ * caf/single.c (caf_runtime_error): Revert 2014-11-28 changes. * runtime/minimal.c (STRERR_MAXSZ): Don't define. (runtime_error_at, sys_abort): Bring more in line with the non-LIBGFOR_MINIMAL code. (runtime_warning_at, internal_error): New functions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221363 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgfortran/ChangeLog | 8 ++++++ libgfortran/caf/single.c | 3 +-- libgfortran/runtime/minimal.c | 58 ++++++++++++++++++++++++++++++++++++++--- 3 files changed, 64 insertions(+), 5 deletions(-) Grüße, Thomas diff --git libgfortran/ChangeLog libgfortran/ChangeLog index 97ee01b..5b201d2 100644 --- libgfortran/ChangeLog +++ libgfortran/ChangeLog @@ -1,3 +1,11 @@ +2015-03-11 Thomas Schwinge + + * caf/single.c (caf_runtime_error): Revert 2014-11-28 changes. + * runtime/minimal.c (STRERR_MAXSZ): Don't define. + (runtime_error_at, sys_abort): Bring more in line with the + non-LIBGFOR_MINIMAL code. + (runtime_warning_at, internal_error): New functions. + 2015-03-11 Janne Blomqvist PR libfortran/65200 diff --git libgfortran/caf/single.c libgfortran/caf/single.c index daef281..6c58286 100644 --- libgfortran/caf/single.c +++ libgfortran/caf/single.c @@ -48,14 +48,13 @@ caf_static_t *caf_static_list = NULL; static void caf_runtime_error (const char *message, ...) { -#ifndef LIBGFOR_MINIMAL va_list ap; fprintf (stderr, "Fortran runtime error: "); va_start (ap, message); vfprintf (stderr, message, ap); va_end (ap); fprintf (stderr, "\n"); -#endif + /* FIXME: Shutdown the Fortran RTL to flush the buffer. PR 43849. */ exit (EXIT_FAILURE); } diff --git libgfortran/runtime/minimal.c libgfortran/runtime/minimal.c index 7ef4647..72a134a 100644 --- libgfortran/runtime/minimal.c +++ libgfortran/runtime/minimal.c @@ -73,7 +73,10 @@ recursion_check (void) magic = MAGIC; } -#define STRERR_MAXSZ 256 + +/* os_error()-- Operating system error. We get a message from the + * operating system, show it and leave. Some operating system errors + * are caught and processed by the library. If not, we come here. */ void os_error (const char *message) @@ -85,6 +88,10 @@ os_error (const char *message) } iexport(os_error); + +/* void runtime_error()-- These are errors associated with an + * invalid fortran program. */ + void runtime_error (const char *message, ...) { @@ -109,7 +116,8 @@ runtime_error_at (const char *where, const char *message, ...) va_list ap; recursion_check (); - printf ("Fortran runtime error: "); + printf ("%s", where); + printf ("\nFortran runtime error: "); va_start (ap, message); vprintf (message, ap); va_end (ap); @@ -118,6 +126,43 @@ runtime_error_at (const char *where, const char *message, ...) } iexport(runtime_error_at); + +void +runtime_warning_at (const char *where, const char *message, ...) +{ + va_list ap; + + printf ("%s", where); + printf ("\nFortran runtime warning: "); + va_start (ap, message); + vprintf (message, ap); + va_end (ap); + printf ("\n"); +} +iexport(runtime_warning_at); + + +/* void internal_error()-- These are this-can't-happen errors + * that indicate something deeply wrong. */ + +void +internal_error (st_parameter_common *cmp, const char *message) +{ + recursion_check (); + printf ("Internal Error: "); + printf ("%s", message); + printf ("\n"); + + /* This function call is here to get the main.o object file included + when linking statically. This works because error.o is supposed to + be always linked in (and the function call is in internal_error + because hopefully it doesn't happen too often). */ + stupid_function_name_for_static_linking(); + + exit (3); +} + + /* Return the full path of the executable. */ char * full_exe_path (void) @@ -153,6 +198,13 @@ get_args (int *argc, char ***argv) void sys_abort (void) { - printf ("Abort called.\n"); + /* If backtracing is enabled, print backtrace and disable signal + handler for ABRT. */ + if (options.backtrace == 1 + || (options.backtrace == -1 && compile_options.backtrace == 1)) + { + printf ("\nProgram aborted.\n"); + } + abort(); }