tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] tcc bug?


From: yan wei
Subject: Re: [Tinycc-devel] tcc bug?
Date: Sun, 31 Jul 2011 08:11:41 +0800
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11

于 2011/7/31 23:24, grischka 写道:
yan wei wrote:
Hi, everyone,

    I use easymesh_1_4.c to test tcc 0.9.25 under win7.  It compiles successfully but "easymesh_1_4.exe example.d" can not work.  This test works ok by using Visual C++ 6.0.
    Does anyone know whether this is an bug of tcc?

Can you tell us what line in the source file causes the problem?

--- grischka

    The test code Easymesh_1_4.c and example1.d can be downloaded here:
    http://www-dinma.univ.trieste.it/nirftc/research/easymesh/

regards,
wyan



Tcc can compile easymesh_1_4.c successfully, but "easymesh_1_4.exe example1.d" runs without stop.
The main loop of the code is about line 2080 in function main, like

    do
    {
     Nn0=Nn;
     new_node();
     classify();
     if(Nn==MAX_NODES-1) break;
     if(Nn==Nn0) break;
    }
   while(ugly!=OFF);

Attachment is the code I changed for test, I just add two printf line for compare
under tcc and vc6. The output for tcc and vc6 looks different. But I don't know why.
It seems that some differents caused by the float error, but I think this is not the main problem.
Because if using vc6 debug mode and release mode to compile the code, the screen output is also
different, but both can finally give the right result.


Add printf code in function classify() at about line 633 like this:
/*------------------------------------------------+
|  First part of the trick:                       |
|    search through the elements on the boundary  |
+------------------------------------------------*/
 for(e=0; e<Ne; e++)
   if(elem[e].mark!=OFF && elem[e].state!=D)
    {
     si=elem[e].si; sj=elem[e].sj; sk=elem[e].sk;

     if(side[si].mark!=0) elem[e].state=A;
     if(side[sj].mark!=0) elem[e].state=A;
     if(side[sk].mark!=0) elem[e].state=A;

     //test line added by wyan
     printf("%d %d %20.22f %30.22f\n", ugly, e, elem[e].R/elem[e].r, ratio);
 
     if(elem[e].state==A && elem[e].R/elem[e].r > ratio)
      {ratio=max(ratio, elem[e].R/elem[e].r);
       ugly=e;}
    }


Add printf code in main() functio at about line 2083 like this
do
    {
     Nn0=Nn;
     new_node();
     classify();
     printf("%d\n", ugly); //test line added by wyan
     if(Nn==MAX_NODES-1) break;
     if(Nn==Nn0) break;
    }
   while(ugly!=OFF);



Attachment: easymesh_1_4.c
Description: Text document

Attachment: example1.d
Description: Text document


reply via email to

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