Subject: CGAL users discussion list
List archive
- From: Sylvain Pion <>
- To:
- Subject: Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3
- Date: Wed, 01 Aug 2007 11:14:51 +0200
- Organization: INRIA
Hi Bernhard,
Bernhard Kornberger a écrit :
[...]
..here is the output without valgrind:
bernd@polar:~/test3
$ ./minkowski
a
b
c
d
e
f
g
h
..and here the output with valgrind:
bernd@polar:~/test3
$ valgrind ./minkowski
==15875== Memcheck, a memory error detector.
==15875== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et al.
==15875== Using LibVEX rev 1658, a library for dynamic binary translation.
==15875== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP.
==15875== Using valgrind-3.2.1-Debian, a dynamic binary instrumentation framework.
==15875== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et al.
==15875== For more details, rerun with: -v
==15875==
a
b
c
d
e
f
CGAL error: precondition violation!
Expr: orientation(p0, p1, p2, p3) == POSITIVE
File: /opt/CGAL330//include/CGAL/Regular_triangulation_3.h
Line: 890
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_S_construct NULL not valid
==15875==
==15875== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 97 from 1)
==15875== malloc/free: in use at exit: 584,171 bytes in 489 blocks.
==15875== malloc/free: 537 allocs, 48 frees, 586,505 bytes allocated.
==15875== For counts of detected errors, rerun with: -v
==15875== searching for pointers to 489 not-freed blocks.
==15875== checked 1,638,696 bytes.
==15875==
==15875== LEAK SUMMARY:
==15875== definitely lost: 0 bytes in 0 blocks.
==15875== possibly lost: 150 bytes in 4 blocks.
==15875== still reachable: 584,021 bytes in 485 blocks.
==15875== suppressed: 0 bytes in 0 blocks.
==15875== Reachable blocks (those to which a pointer was found) are not shown.
==15875== To see them, rerun with: --show-reachable=yes
Aborted
It looks like a valgrind bug to me. Actually, running the basic
test program for FPU rounding modes (attached) fails with valgrind.
So, probably not much will work correctly with CGAL and valgrind :(
--
Sylvain Pion
INRIA Sophia-Antipolis
Geometrica Project-Team
CGAL, http://cgal.org/
// This tests the rounding mode functions.
#include <CGAL/basic.h>
#include <CGAL/Interval_nt.h>
#include <iostream>
typedef CGAL::Interval_nt_advanced NT_adv;
typedef CGAL::Interval_nt<> NT;
void print_res (bool res)
{ std::cout << (res ? "ok" : "ERROR") << std::endl; }
// The results of 1-epsilon and -1+epsilon are enough
// to detect exactly the current rounding mode.
// 1-MIN_DOUBLE
// +------+-------+
// | 1 | 1-ulp |
// +--------+------+-------+
// -1+MIN_DOUBLE | -1 | near | -inf |
// | -1+ulp | +inf | zero |
// +--------+------+-------+
// I use a global variable here to avoid constant propagation.
double IA_min_double;
CGAL::FPU_CW_t
FPU_empiric_test()
{
IA_min_double = CGAL_IA_MIN_DOUBLE;
double y = 1.0, z = -1.0;
double ye, ze;
ye = y - IA_min_double;
ze = z + IA_min_double;
if (y == ye && z == ze) return CGAL_FE_TONEAREST;
if (y == ye) return CGAL_FE_UPWARD;
if (z == ze) return CGAL_FE_DOWNWARD;
return CGAL_FE_TOWARDZERO;
}
// This variable is global in order to stop constant propagation.
double m = 0.5;
CGAL::FPU_CW_t FPU_empiric_test_mul ()
{
int i;
for (i=0; i<10; i++) {m*=m; /* std::cout <<c << std::endl; */ }
double a = m*m;
double b = (-m)*m;
std::cout << "m = " << m << "\n m*m = " << a << "\n (-m)*m = " << b;
std::cout << std::endl;
// Note: it's not supposed to work here like that.
if ((a == 0.0) && (b == 0.0)) return CGAL_FE_TONEAREST;
if (a > 0.0) return CGAL_FE_UPWARD;
if (b < 0.0) return CGAL_FE_DOWNWARD;
return CGAL_FE_TOWARDZERO;
}
void print_rounding_name (CGAL::FPU_CW_t r)
{
switch (r) {
case CGAL_FE_TONEAREST: std::cout << "NEAR\n"; break;
case CGAL_FE_DOWNWARD: std::cout << "DOWN\n"; break;
case CGAL_FE_UPWARD: std::cout << "UP\n"; break;
case CGAL_FE_TOWARDZERO: std::cout << "ZERO\n"; break;
default: std::cout << "unknown !\n";
}
}
int main()
{
bool flag = true;
flag = flag && (FPU_empiric_test() == CGAL_FE_TONEAREST);
std::cout << "default: ";
print_res(flag);
// Should be a no-op.
CGAL::FPU_set_cw(CGAL::FPU_get_cw());
flag = flag && (FPU_empiric_test() == CGAL_FE_TONEAREST);
std::cout << "get/set: ";
print_res(flag);
if (!flag) print_rounding_name(FPU_empiric_test());
// Rounding to zero.
CGAL::FPU_set_cw(CGAL_FE_TOWARDZERO);
flag = flag && (FPU_empiric_test() == CGAL_FE_TOWARDZERO);
std::cout << "zero : ";
print_res(flag);
if (!flag) print_rounding_name(FPU_empiric_test());
// Rounding to infinity.
CGAL::FPU_set_cw(CGAL_FE_UPWARD);
flag = flag && (FPU_empiric_test() == CGAL_FE_UPWARD);
std::cout << "+inf : ";
print_res(flag);
if (!flag) print_rounding_name(FPU_empiric_test());
// Rounding to minus infinity.
CGAL::FPU_set_cw(CGAL_FE_DOWNWARD);
flag = flag && (FPU_empiric_test() == CGAL_FE_DOWNWARD);
std::cout << "-inf : ";
print_res(flag);
if (!flag) print_rounding_name(FPU_empiric_test());
// Rounding to nearest.
CGAL::FPU_set_cw(CGAL_FE_TONEAREST);
flag = flag && (FPU_empiric_test() == CGAL_FE_TONEAREST);
std::cout << "near : ";
print_res(flag);
if (!flag) print_rounding_name(FPU_empiric_test());
return (int) !flag;
}
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Sylvain Pion, 08/01/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Joachim Reichel, 08/01/2007
- <Possible follow-up(s)>
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Bernhard Kornberger, 08/02/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Andreas Fabri, 08/02/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Sylvain Pion, 08/02/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Bernhard Kornberger, 08/02/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Monique . Teillaud, 08/06/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Bernhard Kornberger, 08/06/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Monique . Teillaud, 08/06/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Bernhard Kornberger, 08/06/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Monique . Teillaud, 08/06/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Bernhard Kornberger, 08/06/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Monique . Teillaud, 08/06/2007
- Re: [cgal-discuss] Regular_triangulation_3 Bug, CGAL 3.3, Bernhard Kornberger, 08/02/2007
Archive powered by MHonArc 2.6.16.