public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@redhat.com>
To: Ian Lance Taylor <iant@google.com>
Cc: "Peter A. Felvegi" <petschy@praire-chicken.com>, gcc@gcc.gnu.org
Subject: Re: array subscript is below array bounds : false positive?
Date: Tue, 15 Sep 2009 16:19:00 -0000	[thread overview]
Message-ID: <4AAFBEA2.4070504@redhat.com> (raw)
In-Reply-To: <m3bplcfe8r.fsf@google.com>

On 09/15/2009 09:56 AM, Ian Lance Taylor wrote:
> void assert_failure () __attribute__ ((noreturn, always_inline));
> void assert_failure() { __asm__ ("int $0x03"); }
> #define ASSERT(x) if (x) { } else { assert_failure(); }

Incidentally, there's a __builtin_trap() that you may wish to use.  It 
won't invoke interrupt 3 like you currently do, but it will abort the 
program, and you'll be able to see from whence in the debugger.

Additionally, there are targets for which there exists a conditional 
trap instruction, e.g. sparc:

    cmp 0, %i0	// x in register %i0
    tne 0	// invoke trap vector 0 if compare is "not-equal"


r~

      reply	other threads:[~2009-09-15 16:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-15 10:19 Peter A. Felvegi
2009-09-15 10:30 ` Basile STARYNKEVITCH
2009-09-15 14:56 ` Ian Lance Taylor
2009-09-15 16:19   ` Richard Henderson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AAFBEA2.4070504@redhat.com \
    --to=rth@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=iant@google.com \
    --cc=petschy@praire-chicken.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).