[gfortran] add SIGNAL and ALARM intrinsics
Jakub Jelinek
jakub@redhat.com
Sat Nov 19 12:33:00 GMT 2005
On Sun, Oct 16, 2005 at 12:09:58PM +0200, FX Coudert wrote:
> >I don't understand how you implemented the intrinsic
> >functions for signal.
>
> Right. Sent the wrong version of the patch. Here it is.
>
> 2005-10-15 Francois-Xavier Coudert <coudert@clipper.ens.fr>
>
> * Makefile.am (intrinsics): Add signal.c.
> * Makefile.in: Regenerate.
> * configure.ac: Checks for signal and alarm.
> * config.h.in: Regenerate.
> * configure: Regenerate.
> * intrinsics/signal.c: New file for SIGNAL and ALARM intrinsics.
+#ifdef HAVE_SIGNAL
+ if (status != NULL)
+ *status = (int) signal (*number, handler);
+ else
+ signal (*number, handler);
+#else
(twice in that file) can't be right. signal returns a function pointer
or SIG_ERR. Casting a pointer to int is wrong. Either you want
*status = signal (*number, handler) == SIG_ERR ? -1 : 0;
or
*status = signal (*number, handler) == SIG_ERR ? errno : 0;
but certainly not just some lower bits from the pointer.
Jakub
More information about the Gcc-patches
mailing list