From patchwork Sat Jul 9 18:59:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 104013 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 5B3F51007D1 for ; Sun, 10 Jul 2011 04:59:29 +1000 (EST) Received: (qmail 25325 invoked by alias); 9 Jul 2011 18:59:27 -0000 Received: (qmail 25308 invoked by uid 22791); 9 Jul 2011 18:59:26 -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 mx01.qsc.de (HELO mx01.qsc.de) (213.148.129.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 09 Jul 2011 18:59:10 +0000 Received: from [192.168.178.22] (port-92-204-30-62.dynamic.qsc.de [92.204.30.62]) by mx01.qsc.de (Postfix) with ESMTP id 83AB33D220; Sat, 9 Jul 2011 20:59:08 +0200 (CEST) Message-ID: <4E18A4FC.4030508@net-b.de> Date: Sat, 09 Jul 2011 20:59:08 +0200 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.17) Gecko/20110414 SUSE/3.1.10 Thunderbird/3.1.10 MIME-Version: 1.0 To: gcc patches , gfortran Subject: [Patch, Fortran] PR - fix SIGNAL intrinsic (4.6/4.7 Regression) 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 regression seems to be a side effect of the -fwhole-file effort. The BT_UNKNOWN of the second argument of SIGNAL(NUMBER,HANDLER) triggers an ICE in trans-types.c, when generating the decl for the external function "signal" (or rather for __gfortran_signal_func{,_int}). As both handler == and handler == are pointers, it seems to be simplest to translate the second argument as "void *" (BT_VOID). Build and regtested on x86-64-linux. OK for the trunk and the 4.6 branch? Tobias 2011-07-09 Tobias Burnus PR fortran/49690 * intrinsic.c (add_functions): Use BT_VOID for 2nd argument of SIGNAL. 2011-07-09 Tobias Burnus PR fortran/49690 * gfortran.dg/intrinsic_signal.f90: New. diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index a72da91..5946ddd 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -2594,7 +2594,7 @@ add_functions (void) add_sym_2 ("signal", GFC_ISYM_SIGNAL, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER, di, GFC_STD_GNU, gfc_check_signal, NULL, gfc_resolve_signal, - num, BT_INTEGER, di, REQUIRED, han, BT_UNKNOWN, 0, REQUIRED); + num, BT_INTEGER, di, REQUIRED, han, BT_VOID, 0, REQUIRED); make_generic ("signal", GFC_ISYM_SIGNAL, GFC_STD_GNU); --- /dev/null 2011-07-09 08:27:50.727884038 +0200 +++ gcc/gcc/testsuite/gfortran.dg/intrinsic_signal.f90 2011-07-09 20:19:35.000000000 +0200 @@ -0,0 +1,21 @@ +! { dg-do compile } +! +! PR fortran/49690 +! +! Reduced test case, based on the one of Debian bug #631204 +! + +subroutine ctrlc_ast + common /xinterrupt/ interrupted + logical interrupted + interrupted = .true. +end subroutine ctrlc_ast + +subroutine set_ctrl_c(ctrlc_ast) + external ctrlc_ast + intrinsic signal + integer old_handle + common /xinterrupt/ interrupted + logical interrupted + old_handler = signal(2, ctrlc_ast) +end subroutine set_ctrl_c