From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19580 invoked by alias); 15 Sep 2009 16:19:57 -0000 Received: (qmail 19545 invoked by uid 22791); 15 Sep 2009 16:19:56 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 15 Sep 2009 16:19:51 +0000 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8FGJo6N013391; Tue, 15 Sep 2009 12:19:50 -0400 Received: from stone.twiddle.home (vpn-10-243.rdu.redhat.com [10.11.10.243]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n8FGJm5a022405; Tue, 15 Sep 2009 12:19:49 -0400 Message-ID: <4AAFBEA2.4070504@redhat.com> Date: Tue, 15 Sep 2009 16:19:00 -0000 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.1) Gecko/20090814 Fedora/3.0-2.6.b3.fc11 Thunderbird/3.0b3 MIME-Version: 1.0 To: Ian Lance Taylor CC: "Peter A. Felvegi" , gcc@gcc.gnu.org Subject: Re: array subscript is below array bounds : false positive? References: <4AAF6A13.2090303@praire-chicken.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-09/txt/msg00274.txt.bz2 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~