[Top][All Lists]

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

[Tinycc-devel] Patch to fix double->_Bool conversion (grischka-2005-09-2

From: David A. Wheeler
Subject: [Tinycc-devel] Patch to fix double->_Bool conversion (grischka-2005-09-29 fix 6.2) - more?
Date: Tue, 01 May 2007 17:17:53 -0400 (EDT)

Here's a small patch that fixes a double->_Bool conversion problem in tcc.  
This patch resolves grischka-2005-09-29 fix 6.2.  Huh? What's that?  Some 
history is probably in order, and I hope that I can talk others into looking 
through grischka-2005-09-29 to extract the "good stuff" from it.

On 29 Sep 2005, grischka posted a huge patch with lots of different fixes to 
tcc, including 10 that were necessary to compile gcc 2.95, a bunch of Windows 
fixes, etc. It has lots of good stuff, and I'm calling it grischka-2005-09-29 
so I have a unique name for this thing:

Unfortunately, this megapatch has not been included in either Bellard's 
"mainline" tcc or in Landley's tcc fork.  I'm believe that's in part because 
grischka's patch was a huge one-patch dump of unrelated items, making it much 
harder to examine the changes piece by piece.  I'd like to be able to compile 
gcc using tcc, and I expect that having that capability will make tcc able to 
compile other programs too, so I really want its capabilities integrated 

So I've created a patch that pulls out just one piece, in this case fix 6.2.  
This is a float->_Bool conversion error in tcc.  Currently in tcc the 
expression ((_Bool) 0.1) correctly returns 1, but if double g=0.1, then 
((_Bool) g) incorrectly returns 0 instead of the correct 1.  This patch fixes 
it, and tests to make sure it's fixed.  I _know_ works cleanly against 
Landley's tcc fork, and I expect it to work on the mainline too.

It applies cleanly (use patch -p1). It's not exactly the same as the grishka 
code; the original patch left behind some dead code, which I've removed, and it 
used a separate test file instead of integrating into tcctest.  But those are 
trivial refinements; the code is grishka's.  To make sure that the indentation 
is correct after patching, the patch inserts indentation for a number of lines. 
 My goal was to make sure that the result was correct, instead of having a 
minimal number of lines.

I'm hoping that I and others can work together to get these grischka patches 
integrated somewhere.

--- David A. Wheeler 

Attachment: grishka6.2.patch
Description: Text Data

reply via email to

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