Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #24091

Re: signal() anomaly

From Nick Bowler <nbowler@draconx.ca>
Newsgroups comp.lang.c
Subject Re: signal() anomaly
Date 2012-08-01 20:14 +0000
Organization A noiseless patient Spider
Message-ID <jvc2n0$a0k$1@dont-email.me> (permalink)
References <jv9e9e$bj3$1@speranza.aioe.org> <jv9fiu$3bj$1@dont-email.me>

Show all headers | View raw


On Tue, 31 Jul 2012 16:35:41 -0400, Eric Sosman wrote:

> On 7/31/2012 4:13 PM, hip cat wrote:
>> What up
>>
>> I've used signal to set SIGSEGV to SIG_IGN. But when I later dereference
>> a null pointer my program still crashes out with segfault SIGSEGV. What
>> gives?
> 
>      Did you check that the signal() call succeeded?  That is,
> was the returned value SIG_ERR or something else?
> 
>      On POSIX systems, ignoring SIGSEGV produces undefined behavior.

POSIX is a bit more specific than that.  But regardless...

> The C Standard isn't quite so clear to me: It's U.B. if a signal
> handler for SIGSEGV returns (7.14.1.1p3), but SIG_IGN is not a
> "signal handler" under the definition of 7.14.1.1p2.

...the C standard doesn't need to be any more explicit on this matter.
The behaviour is undefined because the program has dereferenced an
invalid (null) pointer.  The handling of SIGSEGV is irrelevant.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

signal() anomaly hip cat <nospam@nospam.com> - 2012-07-31 20:13 +0000
  Re: signal() anomaly Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-07-31 16:35 -0400
    Re: signal() anomaly hip cat <nospam@nospam.com> - 2012-08-01 18:59 +0000
    Re: signal() anomaly Nick Bowler <nbowler@draconx.ca> - 2012-08-01 20:14 +0000
  Re: signal() anomaly falk@rahul.net (Edward A. Falk) - 2012-07-31 22:12 +0000
    Re: signal() anomaly hip cat <nospam@nospam.com> - 2012-08-01 18:58 +0000
      Re: signal() anomaly James Kuyper <jameskuyper@verizon.net> - 2012-08-01 15:33 -0400
        Re: signal() anomaly hip cat <nospam@nospam.com> - 2012-08-01 20:47 +0000
          Re: signal() anomaly Paul <nospam@needed.com> - 2012-08-01 17:34 -0400
            Re: signal() anomaly Johann Klammer <klammerj@NOSPAM.a1.net> - 2012-08-02 06:34 +0200
              Re: signal() anomaly Paul <nospam@needed.com> - 2012-08-02 07:10 -0400
          Re: signal() anomaly Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-01 18:07 -0400
            Re: signal() anomaly Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-08-02 00:15 +0100
              Re: signal() anomaly Nick Bowler <nbowler@draconx.ca> - 2012-08-02 00:05 +0000
                Re: signal() anomaly Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-08-02 02:47 +0100
          Re: signal() anomaly James Kuyper <jameskuyper@verizon.net> - 2012-08-01 18:13 -0400
          Re: signal() anomaly James Kuyper <jameskuyper@verizon.net> - 2012-08-01 18:14 -0400
          Re: signal() anomaly Nobody <nobody@nowhere.com> - 2012-08-02 12:52 +0100
      Re: signal() anomaly Angel <angel+news@spamcop.net> - 2012-08-01 19:41 +0000
      Re: signal() anomaly Kenneth Brody <kenbrody@spamcop.net> - 2012-08-01 16:16 -0400
      Re: signal() anomaly Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-01 16:33 -0400
      Re: signal() anomaly Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-08-02 00:22 +0100
      Re: signal() anomaly Stephen Sprunk <stephen@sprunk.org> - 2012-08-02 00:55 -0500
        Re: signal() anomaly Ike Naar <ike@sverige.freeshell.org> - 2012-08-02 07:01 +0000
      Re: signal() anomaly Öö Tiib <ootiib@hot.ee> - 2012-09-08 20:53 -0700
  Re: signal() anomaly Nobody <nobody@nowhere.com> - 2012-08-01 18:06 +0100
    Re: signal() anomaly Tim Rentsch <txr@alumni.caltech.edu> - 2012-09-07 13:44 -0700
  Re: signal() anomaly Kleuske <kleuske@nowhere.net> - 2012-08-02 20:52 +0000

csiph-web