|
From: | grischka |
Subject: | Re: [Tinycc-devel] tricky little bounds-checking bug |
Date: | Sat, 26 Mar 2011 13:13:39 +0100 |
User-agent: | Thunderbird 2.0.0.24 (Windows/20100228) |
Joe Soroka wrote:
--------------------- char xyz[123]; void main(void) { int i = 0; xyz[0] = !i; } -------------------- This comes from trying to get tcc to run itself with bounds-checking turned on. This is a reduced form of "init isid table" in preprocess_new(). Looking at the disassembly, it seems that the '!' operator causes a register to be stomped on. Some other expressions do the same thing, like "i || 1". I've tried to fix it, but I'm kinda lost in the bounds-checking logic. Anyone have any ideas?
I recall there was a similar problem without bounds-checking: http://landley.net/hg/tinycc/rev/3f48bed56ab4 The patch is part of: http://repo.or.cz/w/tinycc.git/commitdiff/54bf8c05566a34f4d578ed6d33d6262dc924a703 logged as: + 437: Call 'saveregs()' before jumping with logical and/or/not (grischka) --- grischka
[Prev in Thread] | Current Thread | [Next in Thread] |