wo80 / Triangle

CMake project for Jonathan Shewchuk's Triangle mesh generator.
Other
63 stars 26 forks source link

Crash in triangle-test when building w/o acute #20

Closed jzarl closed 6 years ago

jzarl commented 6 years ago

When building without acute, I get the following segfault when executing triangle-test:

(gdb) run
Starting program: /home/zing/Projects/femm/Triangle/src/build/examples/triangle-test/triangle-test 
OK: test_context_create_destroy
OK: test_behavior_parse

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7bc5be5 in markhull (m=m@entry=0x55555577f890, b=b@entry=0x5555557574e0) at /home/zing/Projects/femm/Triangle/src/Triangle/triangle.c:6482
6482      symself(hulltri);
(gdb) bt
#0  0x00007ffff7bc5be5 in markhull (m=m@entry=0x55555577f890, b=b@entry=0x5555557574e0) at /home/zing/Projects/femm/Triangle/src/Triangle/triangle.c:6482
#1  0x00007ffff7bc5d13 in formskeleton (m=m@entry=0x55555577f890, b=b@entry=0x5555557574e0, segmentlist=<optimized out>, segmentmarkerlist=<optimized out>, numberofsegments=<optimized out>, 
    status=status@entry=0x7fffffffdc8c) at /home/zing/Projects/femm/Triangle/src/Triangle/triangle.c:6577
#2  0x00007ffff7bbb96e in triangle_mesh_create (ctx=ctx@entry=0x555555757580, in=in@entry=0x7fffffffdcb0) at /home/zing/Projects/femm/Triangle/src/examples/libtriangle/triangle_api.c:204
#3  0x0000555555554d79 in test_mesh_create (ctx=0x555555757580) at /home/zing/Projects/femm/Triangle/src/examples/triangle-test/tests.c:68
#4  0x0000555555554a7d in main () at /home/zing/Projects/femm/Triangle/src/examples/triangle-test/main.c:42

Note: in order to pass test_behavior_parse I commented out the following line from tests.c:

    result &= (b->maxangle == 100.0); // line 41
wo80 commented 6 years ago

This is because the NO_ACUTE flag isn't set for the executable projects and so the behavior and mesh structs get messed up.

A fix would either be to define the flag for all projects, or remove the #ifndef NO_ACUTE from the structure definitions.

jzarl commented 6 years ago

You're right - I've fixed my build to set NO_ACUTE properly in all places and the problem is gone now…