This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: array subscript is below array bounds : false positive?


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~



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]