This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Incorrect results from numerical library when using -ftree-ter


On 8 June 2012 00:50, Ian Lance Taylor <iant@google.com> wrote:
> Szabolcs HorvÃt <szhorvat@gmail.com> writes:
>
>> I am using the Triangle library
>> <http://www.cs.cmu.edu/~quake/triangle.html> to generate Delaunay
>> triangulations of a large number of points. ÂWhen I compile this
>> library using the -ftree-ter optimization option only, the library
>> gives me incorrect results for certain inputs. ÂThe -ftree-ter Âoption
>> is enabled by optimization level -O1 or higher, which also cause the
>> library to return incorrect results.
>>
>> Question: ÂDoes this indicate that there is a bug in gcc or is it more
>> likely that there's a problem in how the library is written?
>>
>> Unfortunately I am not familiar with the code of Triangle, I just
>> compile it and use it.
>>
>> I tried this with gcc 4.6.3 on Ubuntu and gcc 4.7.0 on Windows (from
>> <http://nuwen.net/mingw.html>), both 32-bit.
>
>
> While a bug in GCC is always possible, it is more likely that there's a
> problem in how the library is written.
>

Unfortunately I am not in a position to find out if it's a problem
with Triangle as I don't know in detail how it works.  Triangle is
quite extensively used though, and it's last version is from 2005.  I
wonder why the problem has not come out before.

A strange thing is that I get a different kind of incorrect result if
I use the -O1 option or if I manually specify all the flags that -O1
is supposed to turn on.  What could be the reason for this?  I got the
list of flags from here:
http://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Optimize-Options.html#Optimize-Options

Similarly, using -O1 -fno-tree-ter does NOT fix the problem.
Specifying all options that -O1 is supposed to imply according to the
docs, except -ftree-ter DOES fix the problem.

What is the difference between -O1 and listing all options that it implies?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]