diff --git a/Packages/Interval_arithmetic/changes.txt b/Packages/Interval_arithmetic/changes.txt index edda6948f10..a5026a59256 100644 --- a/Packages/Interval_arithmetic/changes.txt +++ b/Packages/Interval_arithmetic/changes.txt @@ -1,3 +1,6 @@ +Version 4.140 on 15 April 2002 +- Workaround a bug in GCC 3.0.4 detected by Matthias. + Version 4.139 on 13 April 2002 - Shorten symbol names in test/Filtered_kernel.C. diff --git a/Packages/Interval_arithmetic/include/CGAL/Interval_base.h b/Packages/Interval_arithmetic/include/CGAL/Interval_base.h index 38116facd04..7b7c4f9df37 100644 --- a/Packages/Interval_arithmetic/include/CGAL/Interval_base.h +++ b/Packages/Interval_arithmetic/include/CGAL/Interval_base.h @@ -40,6 +40,12 @@ struct Interval_base Interval_base () {} + // This copy ctor, normally equivalent to the one created by the compiler, + // appears to fix a code generation problem with GCC 3.0.4... + // (see test/IA/gcc_3.0.bug.C). + Interval_base (const Interval_base &i) + : inf_(i.inf_), sup_(i.sup_) {} + Interval_base (const double d) : inf_(d), sup_(d) {} diff --git a/Packages/Interval_arithmetic/test/Interval_arithmetic/gcc_3.0_bug.C b/Packages/Interval_arithmetic/test/Interval_arithmetic/gcc_3.0_bug.C new file mode 100644 index 00000000000..c19156c38ac --- /dev/null +++ b/Packages/Interval_arithmetic/test/Interval_arithmetic/gcc_3.0_bug.C @@ -0,0 +1,60 @@ +/* + This test file has been distilled from a bug-report from Matthias. + Probably a GCC 3.0.4 code generation bug. + It shows up only with -O -DNDEBUG. + It goes away when : + - operator-(Interval) is not inline + - copy ctor of Interval_base is written explicitly. + +> Have you made some progress for this bug ? +> If you could try to keep the bug without having the test program depend on +> LEDA, I could have a look at it, but currently I can't even compile it... +> -- +> Sylvain + +I've changed one of the examples from the Triangulation_3 examples a bit +and it shows the same behavior. + +When I compile with -DNDEBUG it loops; removing -DNDEBUG from the +makefile makes it work. I attach the makefile and the example. + +Matthias + +*/ + +#ifndef NDEBUG +#define NDEBUG +#endif + +#include +#include + +#include + +typedef CGAL::Interval_nt_advanced NT; +typedef CGAL::Simple_cartesian K; + +int main() +{ + std::cout.precision(20); + CGAL::Bounded_side bs; + K::Point_3 p0(0, 0, 0); + K::Point_3 p1(1, 0, 0); + K::Point_3 p2(0, 1, 0); + + { + CGAL::Protect_FPU_rounding p; + bs = CGAL::coplanar_side_of_bounded_circle(p0, p1, p2, p0); + } + + if (bs != CGAL::ON_BOUNDARY) { + std::cout << "BUG ! " << (int) bs << std::endl; + abort(); + } + + std::cout << p0 << std::endl; + std::cout << p1 << std::endl; + std::cout << p2 << std::endl; + + return 0; +}