[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] 111_conversion.c with bounds checking

From: Michael Matz
Subject: Re: [Tinycc-devel] 111_conversion.c with bounds checking
Date: Tue, 10 Dec 2019 16:58:41 +0000 (UTC)
User-agent: Alpine 2.21 (LSU 202 2017-01-01)


On Tue, 10 Dec 2019, Herman ten Brugge via Tinycc-devel wrote:

> I still have one small problem with testcase 111_conversion.c
> The problem is that it fails on i386.c (linux) when compiling with:
> tcc 111_conversion.c -o 111_conversion -b
> ./111_conversion
> I fixed this (and commited it in git) with the following patch in tccgen.c:
>                 if ((p->r2 & VT_VALMASK) < VT_CONST) {
>                     size *= 2;
>                     align *= 2;
>                 }

I've analyzed this now and pushed something slightly different with a 
comment.  It boils down to the above being a work-around for an 
inconsistency between types and r2 entries in the vstack.  My variant is 
also just a work-around.  Unfortunately there are many places in TCC that 
aren't careful with this, so the real fixes have to wait until someone has 
more time at hand.  I guess adding asserts at strategic places and then 
fixing them until they don't hit anymore is the simplest, but still a bit 
of work.  (The asserts would test that a vstack entry has a large type 
that really requires two registers or has VT_CONST in r2).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]