public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch, Fortran] PR - fix SIGNAL intrinsic (4.6/4.7 Regression)
@ 2011-07-09 20:14 Tobias Burnus
  2011-07-10 14:24 ` Mikael Morin
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Burnus @ 2011-07-09 20:14 UTC (permalink / raw)
  To: gcc patches, gfortran

[-- Attachment #1: Type: text/plain, Size: 538 bytes --]

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 == <integer expression> and handler == <subroutine 
proc-pointer> 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

[-- Attachment #2: signal.diff --]
[-- Type: text/x-patch, Size: 1424 bytes --]

2011-07-09  Tobias Burnus  <burnus@net-b.de>

	PR fortran/49690
	* intrinsic.c (add_functions): Use BT_VOID for 2nd argument of SIGNAL.

2011-07-09  Tobias Burnus  <burnus@net-b.de>

	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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Patch, Fortran] PR - fix SIGNAL intrinsic (4.6/4.7 Regression)
  2011-07-09 20:14 [Patch, Fortran] PR - fix SIGNAL intrinsic (4.6/4.7 Regression) Tobias Burnus
@ 2011-07-10 14:24 ` Mikael Morin
  0 siblings, 0 replies; 2+ messages in thread
From: Mikael Morin @ 2011-07-10 14:24 UTC (permalink / raw)
  To: fortran; +Cc: Tobias Burnus, gcc patches

On Saturday 09 July 2011 20:59:08 Tobias Burnus wrote:
> 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 == <integer expression> and handler == <subroutine
> proc-pointer> 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?
OK.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-10 10:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-09 20:14 [Patch, Fortran] PR - fix SIGNAL intrinsic (4.6/4.7 Regression) Tobias Burnus
2011-07-10 14:24 ` Mikael Morin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).