qbe

Internal scc patchset buffer for QBE
Log | Files | Refs | README | LICENSE

commit 15cee065a57ed7c7f5272bb6b60f7518121ec4da
parent a7fb69fd782470e20553e90e97fcc13f9218e2ae
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date:   Fri,  8 Apr 2016 09:40:07 -0400

simplify a buggy test

I found it by compiling -O2 and seeing the ABI code
fail.  Further investigation revealed GCC trimmed
away the last iteration of the loop because I was
accessing the third element of an array of size two.
This is undefined behavior, so GCC "proved" that the
last iteration was never run.

Diffstat:
Msysv.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sysv.c b/sysv.c @@ -92,7 +92,7 @@ retr(Ref reg[2], AClass *aret) nr[0] = nr[1] = 0; ca = 0; - for (n=0; aret->cls[n]>=0 && n<2; n++) { + for (n=0; (uint)n*8<aret->size; n++) { k = KBASE(aret->cls[n]); reg[n] = TMP(retreg[k][nr[k]++]); ca += 1 << (2 * k);