From patchwork Fri Jan 21 13:37:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 79838 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]) by ozlabs.org (Postfix) with SMTP id BF8A0B70E6 for ; Sat, 22 Jan 2011 00:37:52 +1100 (EST) Received: (qmail 28971 invoked by alias); 21 Jan 2011 13:37:44 -0000 Received: (qmail 28958 invoked by uid 22791); 21 Jan 2011 13:37:43 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mx02.qsc.de (HELO mx02.qsc.de) (213.148.130.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 21 Jan 2011 13:37:22 +0000 Received: from [192.168.178.22] (port-92-204-33-159.dynamic.qsc.de [92.204.33.159]) by mx02.qsc.de (Postfix) with ESMTP id F1AB71E624; Fri, 21 Jan 2011 14:37:19 +0100 (CET) Message-ID: <4D398C0F.5090801@net-b.de> Date: Fri, 21 Jan 2011 14:37:19 +0100 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101206 SUSE/3.1.7 Thunderbird/3.1.7 MIME-Version: 1.0 To: gfortran , gcc patches Subject: [Patch, Fortran] PR 47394 Don't ICE on Windows after a fatal error 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 The problem is that gfortran returned with "exit(3)" for fatal errors. Seemingly, "3" means "abort()" on Windows - thus the driver (gcc.c) duly printed an ICE. The solution is use the values defined in ./gcc/system.h. Thanks to Kai for some suggestions and confirming that exit(3) might be regarded as abort(). Build on x86-64-linux. OK for the trunk? What about other branches? Tobias PS: I would be happy if someone could confirm that this patch indeed fixes this old bug. 2011-01-21 Tobias Burnus PR fortran/47394 * error.c (gfc_error_now, gfc_fatal_error, gfc_error_check): Use defined instead of magic number exit status codes. * scanner.c (include_line, gfc_new_file): Ditto. diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c index 3092828..bedb629 100644 --- a/gcc/fortran/error.c +++ b/gcc/fortran/error.c @@ -939,7 +939,7 @@ gfc_error_now (const char *gmsgid, ...) buffer_flag = i; if (flag_fatal_errors) - exit (1); + exit (FATAL_EXIT_CODE); } @@ -956,7 +956,7 @@ gfc_fatal_error (const char *gmsgid, ...) error_print (_("Fatal Error:"), _(gmsgid), argp); va_end (argp); - exit (3); + exit (FATAL_EXIT_CODE); } @@ -1019,7 +1019,7 @@ gfc_error_check (void) gfc_increment_error_count(); if (flag_fatal_errors) - exit (1); + exit (FATAL_EXIT_CODE); } return rc; diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index c226bae..ac26a80 100644 --- a/gcc/fortran/scanner.c +++ b/gcc/fortran/scanner.c @@ -1868,7 +1868,7 @@ include_line (gfc_char_t *line) filename = gfc_widechar_to_char (begin, -1); if (load_file (filename, NULL, false) == FAILURE) - exit (1); + exit (FATAL_EXIT_CODE); gfc_free (filename); return true; @@ -2072,7 +2072,7 @@ gfc_new_file (void) printf ("%s:%3d %s\n", LOCATION_FILE (line_head->location), LOCATION_LINE (line_head->location), line_head->line); - exit (0); + exit (SUCCESS_EXIT_CODE); #endif return result;