Added Nef_S2 Qt5 visualization
Please use the following template to help us managing pull requests.
Summary of Changes
Adding back QT5 Nef_S2 visualization following discussion in #3473
In comparison to #3473, draw_nef_s2.h is also part of the examples. It can be moved to the Nef_S2 package if needed.
Release Management
- Affected package(s): Nef_S2
- Issue(s) solved (if any): fix #3473
- Feature/Small Feature (if any):
- Link to compiled documentation (obligatory for small feature) link
- License and copyright ownership:
I've implemented the suggested changes. While testing, I found that the createRandomNefS2 function segfaults in the draw_nef_s2.cpp code if compiled in Release. It works fine in RelWithDebInfo and Debug. The same code runs fine in release if the draw_nef_s2 function is not called (although it is normally called after the segfault point). The same code works fine in all compile modes in the nef_S2.cpp example. Is this a known problem with g++ being too aggressive in its optimizations in Release mode? This feels like some buffer overflow or stack corruption, but this is fairly hard to debug without the DebugInfo...
It is probably an error you made. Optimisation errors are very rare nowdays in g++.
If you have a recent g++, you can try to add -fsanitizer=address -g3 to your compiler flags, in Release. That may help detect buffer overflows or uses-after-free.
I don't know much about OpenGL but the original code use the glLightfv function and gluQuadricNormal /usr/bin/ld: CMakeFiles/nef_S2.dir/Qt_widget_OpenGL.cpp.o: undefined reference to symbol 'glLightfv' CGAL/Nef_S2/Sphere_geometry_OGL.h:471: undefined reference to `gluQuadricNormals'
I tried removing glut GLU and GL and I got the above. I'm not sure what is the proper CMake magic to find these one and how they combine with the WITH_OPENGL flag.
On Wed, Dec 5, 2018 at 9:43 AM Laurent Rineau [email protected] wrote:
@lrineau commented on this pull request.
In Nef_S2/examples/Nef_S2/CMakeLists.txt https://github.com/CGAL/cgal/pull/3511#discussion_r238972578:
qt5_generate_moc(include/CGAL/Nef_S2/Qt_widget_OpenGL.h Qt_widget_OpenGL.h.moc.cpp)qt5_generate_moc(include/CGAL/Nef_S2/Qt_widget_Nef_S2.h Qt_widget_Nef_S2.h.moc.cpp)add_executable(nef_S2"nef_S2.cpp""Qt_widget_OpenGL.h.moc.cpp""Qt_widget_Nef_S2.h.moc.cpp""Qt_widget_Nef_S2.cpp""Qt_widget_OpenGL.cpp" )target_link_libraries(nef_S2 PRIVATE CGAL::CGAL)if(CGAL_3RD_PARTY_LIBRARIES)target_link_libraries(nef_S2 PRIVATE ${CGAL_3RD_PARTY_LIBRARIES})endif()target_link_libraries(nef_S2 PRIVATE ${CGAL_LIBRARIES} Qt5::Widgets Qt5::OpenGL glut GLU GL )You probably do not need glut and GLU. And if you use the Qt5 OpenGL module, GL is not required either.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CGAL/cgal/pull/3511#pullrequestreview-181641002, or mute the thread https://github.com/notifications/unsubscribe-auth/AAepk4IgdS2TZ-0wXsngOX1gnvEjutJWks5u14cngaJpZM4Y_YWF .
-- Cedric Pradalier
Thanks for the flag. I don't really believe in the G++ error either.
Now some more experiments. For reference, the code with numbered line is below, I'm compiling in Release only. The errors I observed do not happen in other compile mode.
-
First tests were made with Simple_cartesian kernel. Without line 25, the program returns normally.
-
Adding line 25 triggers a segfault in line 16. Yes this is 10 lines before. GDB reports the following:
(gdb) where #0 0x000000000046ffc6 in CGAL::stl_seg_overlay_traits<std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq
, CGAL::SMO_from_segs<CGAL::SM_overlayer<CGAL::SM_decorator<CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SM_items, bool> > >, std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq
, CGAL::Negative_halfsphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq > ::process_event() () #1 0x000000000047272c in void CGAL::SM_overlayer<CGAL::SM_decorator<CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SM_items, bool> > ::create_from_circles<std::_List_iterator<CGAL::Sphere_circle<CGAL::Simple_cartesianCGAL::Gmpq
(std::_List_iterator<CGAL::Sphere_circle<CGAL::Simple_cartesianCGAL::Gmpq
, std::_List_iterator<CGAL::Sphere_circle<CGAL::Simple_cartesianCGAL::Gmpq ) () #2 0x0000000000473969 in void CGAL::create_random_Nef_S2<CGAL::Simple_cartesianCGAL::Gmpq, CGAL::SM_items, bool>(CGAL::Nef_polyhedron_S2<CGAL::Simple_cartesianCGAL::Gmpq, CGAL::SM_items, bool, CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SM_items, bool> >&, int, int) () #3 0x0000000000433c87 in main ()
- Replacing Simple_cartesian with Cartesian (line 9 vs 10), makes the problem disappear.
- #include <CGAL/basic.h>
- #include <CGAL/Exact_rational.h>
- #include <CGAL/Simple_cartesian.h>
- #include <CGAL/Cartesian.h>
- #include <CGAL/Nef_polyhedron_S2.h>
- #include "CGAL/Nef_S2/create_random_Nef_S2.h"
- #include "CGAL/Nef_S2/draw_nef_S2.h"
- typedef CGAL::Exact_rational FT;
- // typedef CGAL::Cartesian<FT> Kernel;
- typedef CGAL::Simple_cartesian<FT> Kernel;
- typedef CGAL::Nef_polyhedron_S2<Kernel> Nef_polyhedron_S2;
- int main(int argc, char* argv[])
- {
- Nef_polyhedron_S2 S1,S2,S3;
- std::cout << "Create RANDOM 0" << std::endl;
- create_random_Nef_S2(S1,5);
- std::cout << "Create RANDOM 1" << std::endl;
- create_random_Nef_S2(S2,5);
- std::cout << "Create RANDOM 2" << std::endl;
- create_random_Nef_S2(S3,5);
- std::cout << "Create RANDOM Done" << std::endl;
- std::cout << S1 << std::endl;
- std::cout << S2 << std::endl;
- std::cout << S3 << std::endl;
- CGAL::draw<Nef_polyhedron_S2>(S3);
- return EXIT_SUCCESS;
- }
On Wed, Dec 5, 2018 at 9:41 AM Laurent Rineau [email protected] wrote:
It is probably an error you made. Optimisation errors are very rare nowdays in g++.
If you have a recent g++, you can try to add -fsanitizer=address -g3 to your compiler flags, in Release. That may help detect buffer overflows or uses-after-free.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CGAL/cgal/pull/3511#issuecomment-444404081, or mute the thread https://github.com/notifications/unsubscribe-auth/AAepkzTe_LWu7Tya0r9uHRi8xM3z82Wjks5u14bKgaJpZM4Y_YWF .
-- Cedric Pradalier
I have a patch to make it compile.
diff --git a/Nef_S2/examples/Nef_S2/include/CGAL/Nef_S2/Qt_widget_Nef_S2.h b/Nef_S2/examples/Nef_S2/include/CGAL/Nef_S2/Qt_widget_Nef_S2.h
index 121e66143d8..5c5db2d007e 100644
--- a/Nef_S2/examples/Nef_S2/include/CGAL/Nef_S2/Qt_widget_Nef_S2.h
+++ b/Nef_S2/examples/Nef_S2/include/CGAL/Nef_S2/Qt_widget_Nef_S2.h
@@ -23,7 +23,7 @@
#include <CGAL/Nef_S2/Sphere_geometry_OGL.h>
#include "CGAL/Nef_S2/Qt_widget_OpenGL.h"
-#include <boost/thread/mutex.hpp>
+#include <CGAL/mutex.h>
namespace CGAL {
@@ -45,7 +45,7 @@ class Qt_widget_Nef_S2 : public Qt_widget_OpenGL {
virtual ~Qt_widget_Nef_S2();
protected:
- boost::mutex mutex;
+ CGAL_MUTEX mutex;
};
Sorry, I did not know about CGAL_MUTEX; Thanks for patching.
Hi @cedricpradalier,
We are reluctant to integrate the pull-request as it is, because its code uses:
- GLU and GLUT,
- and OpenGL direct mode (with
glBeginand so on), instead of modern OpenGL (with buffers and shaders).
@maxGimeno will have a look at the code, and try to find how much work from him would be necessary to transform the code.
Thanks. I have no knowledge about this part at all. I just ported the Qt3 version and left all the opengl as is.
@cedricpradalier Can you please add us as collaborators of your fork?
https://github.com/cedricpradalier/cgal/settings/collaboration
Please add maxGimeno and lrineau.
@maxGimeno @lrineau I suggest again to use basic viewer...
@gdamiand We discussed it with lrineau, for now we just want the PR as it is to compile and run without warning to integrate it. If we manage that, I will probably port the code to a basic_viewer for Nesh_polyhedron_2, but later.
@gdamiand commented on Dec 7, 2018, 11:35 AM GMT+1:
@maxGimeno @lrineau I suggest again to use basic viewer...
There are a lot of interaction in the Nef_s2 viewer, for which the basic viewer is too basic. But maybe by a derivation from it.
Yes it is possible to inherit from basic viewer and add interactions (I just did that for the LCC demo, cf my last PR).
Thanks @cedricpradalier. I have pushed the fix with <CGAL/mutex.h> to avoid having the dependency on Boost Thread with recent C++11 compilers.
About the segfault, with the flag -fsanitize=address, the compiler shows that there is a use-after-scope.
Thanks. I need to hone my skills with fsanitize which I did not know beforehand. In my setup fsanitize only shows me memory leaks but the segfault disappears (it comes back if I comment out the option...). Weird... g++ (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
Can you send me your AddressSanitizer output for comparison? It may gives me an hint on where to search. Thanks
I get :
==11859==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7ffd86440390 at pc 0x559e024db0b0 bp 0x7ffd8643f9a0 sp 0x7ffd8643f990
READ of size 4 at 0x7ffd86440390 thread T0
#0 0x559e024db0af in CGAL::Positive_halfsphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq >::compare_xy(CGAL::Sphere_point<CGAL::Simple_cartesianCGAL::Gmpq > const&, CGAL::Sphere_point<CGAL::Simple_cartesianCGAL::Gmpq > const&) const (/home/gimeno/CGAL/Nef_S2/examples/build/draw_nef_s2+0x1f50af)
#1 0x559e0253eb72 in CGAL::stl_seg_overlay_traits<std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq > >, CGAL::SMO_from_segs<CGAL::SM_overlayer<CGAL::SM_decorator<CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq >, CGAL::SM_items, bool> > >, std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq > > >, CGAL::Positive_halfsphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq > >::compare_pnts_xy::operator()(CGAL::Sphere_point<CGAL::Simple_cartesianCGAL::Gmpq > const&, CGAL::Sphere_point<CGAL::Simple_cartesianCGAL::Gmpq > const&) const (/home/gimeno/CGAL/Nef_S2/examples/build/draw_nef_s2+0x258b72)
#2 0x559e02584749 in CGAL::Multiset<CGAL::Sphere_point<CGAL::Simple_cartesianCGAL::Gmpq >, CGAL::stl_seg_overlay_traits<std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq > >, CGAL::SMO_from_segs<CGAL::SM_overlayer<CGAL::SM_decorator<CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq >, CGAL::SM_items, bool> > >, std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq > > >, CGAL::Positive_halfsphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq > >::compare_pnts_xy, std::allocator
Address 0x7ffd86440390 is located in stack of thread T0 at offset 96 in frame #0 0x559e024a0c71 in void CGAL::SM_overlayer<CGAL::SM_decorator<CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq >, CGAL::SM_items, bool> > >::create_from_circles<std::_List_iterator<CGAL::Sphere_circle<CGAL::Simple_cartesianCGAL::Gmpq > > >(std::_List_iterator<CGAL::Sphere_circle<CGAL::Simple_cartesianCGAL::Gmpq > >, std::_List_iterator<CGAL::Sphere_circle<CGAL::Simple_cartesianCGAL::Gmpq > >) (/home/gimeno/CGAL/Nef_S2/examples/build/draw_nef_s2+0x1bac71)
This frame has 46 object(s):
[32, 33) '
Apparently, compare_xy() is called on a point that has been destroyed.
Ok, this is consistent with what gdb reports and fairly deep inside the Nef_S2 constructor.
This does not really explains why this happens only in release mode and only if we plan to display the polygon later in the code.
On Fri, Dec 7, 2018, 13:02 Maxime GIMENO <[email protected] wrote:
I get :
==11859==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7ffd86440390 at pc 0x559e024db0b0 bp 0x7ffd8643f9a0 sp 0x7ffd8643f990 READ of size 4 at 0x7ffd86440390 thread T0 #0 0x559e024db0af in CGAL::Positive_halfsphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq
::compare_xy(CGAL::Sphere_point<CGAL::Simple_cartesianCGAL::Gmpq > const&, CGAL::Sphere_point<CGAL::Simple_cartesianCGAL::Gmpq > const&) const (/home/gimeno/CGAL/Nef_S2/examples/build/draw_nef_s2+0x1f50af) #1 https://github.com/CGAL/cgal/pull/1 0x559e0253eb72 in CGAL::stl_seg_overlay_traits<std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq
, CGAL::SMO_from_segs<CGAL::SM_overlayer<CGAL::SM_decorator<CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SM_items, bool> > >, std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq > , CGAL::Positive_halfsphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq > ::compare_pnts_xy::operator()(CGAL::Sphere_point<CGAL::Simple_cartesianCGAL::Gmpq const&, CGAL::Sphere_point<CGAL::Simple_cartesianCGAL::Gmpq > const&) const (/home/gimeno/CGAL/Nef_S2/examples/build/draw_nef_s2+0x258b72) #2 https://github.com/CGAL/cgal/issues/2 0x559e02584749 in CGAL::Multiset<CGAL::Sphere_point<CGAL::Simple_cartesianCGAL::Gmpq >, CGAL::stl_seg_overlay_traits<std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SMO_from_segs<CGAL::SM_overlayer<CGAL::SM_decorator<CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SM_items, bool> > >, std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq > , CGAL::Positive_halfsphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq > ::compare_pnts_xy, std::allocator >::Node* CGAL::Multiset<CGAL::Sphere_point<CGAL::Simple_cartesianCGAL::Gmpq >, CGAL::stl_seg_overlay_traits<std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SMO_from_segs<CGAL::SM_overlayer<CGAL::SM_decorator<CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SM_items, bool> > >, std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq > , CGAL::Positive_halfsphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq > ::compare_pnts_xy, std::allocator ::_bound<CGAL::Sphere_point<CGAL::Simple_cartesianCGAL::Gmpq >, CGAL::stl_seg_overlay_traits<std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SMO_from_segs<CGAL::SM_overlayer<CGAL::SM_decorator<CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SM_items, bool> > >, std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq > , CGAL::Positive_halfsphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq > ::compare_pnts_xy>(CGAL::Multiset<CGAL::Sphere_point<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::stl_seg_overlay_traits<std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SMO_from_segs<CGAL::SM_overlayer<CGAL::SM_decorator<CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SM_items, bool> > >, std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq > , CGAL::Positive_halfsphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq > ::compare_pnts_xy, std::allocator >::Bound_type, CGAL::Sphere_point<CGAL::Simple_cartesianCGAL::Gmpq > const&, CGAL::stl_seg_overlay_traits<std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SMO_from_segs<CGAL::SM_overlayer<CGAL::SM_decorator<CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SM_items, bool> > >, std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq > , CGAL::Positive_halfsphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq > ::compare_pnts_xy const&, bool&) const (/home/gimeno/CGAL/Nef_S2/examples/build/draw_nef_s2+0x29e749) #3 https://github.com/CGAL/cgal/pull/3 0x559e0257d281 in CGAL::Multiset<CGAL::Sphere_point<CGAL::Simple_cartesianCGAL::Gmpq >, CGAL::stl_seg_overlay_traits<std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SMO_from_segs<CGAL::SM_overlayer<CGAL::SM_decorator<CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SM_items, bool> > >, std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq > , CGAL::Positive_halfsphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq > ::compare_pnts_xy, std::allocator >::iterator CGAL::Multiset<CGAL::Sphere_point<CGAL::Simple_cartesianCGAL::Gmpq >, CGAL::stl_seg_overlay_traits<std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SMO_from_segs<CGAL::SM_overlayer<CGAL::SM_decorator<CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SM_items, bool> > >, std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq > , CGAL::Positive_halfsphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq > ::compare_pnts_xy, std::allocator ::upper_bound<CGAL::Sphere_point<CGAL::Simple_cartesianCGAL::Gmpq >, CGAL::stl_seg_overlay_traits<std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SMO_from_segs<CGAL::SM_overlayer<CGAL::SM_decorator<CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SM_items, bool> > >, std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq > , CGAL::Positive_halfsphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq > ::compare_pnts_xy>(CGAL::Sphere_point<CGAL::Simple_cartesianCGAL::Gmpq > const&, CGAL::stl_seg_overlay_traits<std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SMO_from_segs<CGAL::SM_overlayer<CGAL::SM_decorator<CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SM_items, bool> > >, std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq > , CGAL::Positive_halfsphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq > ::compare_pnts_xy const&) (/home/gimeno/CGAL/Nef_S2/examples/build/draw_nef_s2+0x297281) #4 https://github.com/CGAL/cgal/pull/4 0x559e0253f402 in CGAL::Multiset<CGAL::Sphere_point<CGAL::Simple_cartesianCGAL::Gmpq >, CGAL::stl_seg_overlay_traits<std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SMO_from_segs<CGAL::SM_overlayer<CGAL::SM_decorator<CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SM_items, bool> > >, std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq > , CGAL::Positive_halfsphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq > ::compare_pnts_xy, std::allocator ::upper_bound(CGAL::Sphere_point<CGAL::Simple_cartesianCGAL::Gmpq > const&) (/home/gimeno/CGAL/Nef_S2/examples/build/draw_nef_s2+0x259402) #5 https://github.com/CGAL/cgal/pull/5 0x559e024fec4e in CGAL::stl_seg_overlay_traits<std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SMO_from_segs<CGAL::SM_overlayer<CGAL::SM_decorator<CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SM_items, bool> > >, std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq > , CGAL::Positive_halfsphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq > ::insertXS(CGAL::Sphere_point<CGAL::Simple_cartesianCGAL::Gmpq > const&) (/home/gimeno/CGAL/Nef_S2/examples/build/draw_nef_s2+0x218c4e) #6 https://github.com/CGAL/cgal/pull/6 0x559e024cc471 in CGAL::stl_seg_overlay_traits<std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SMO_from_segs<CGAL::SM_overlayer<CGAL::SM_decorator<CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SM_items, bool> > >, std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq > , CGAL::Positive_halfsphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq > ::initialize_structures() (/home/gimeno/CGAL/Nef_S2/examples/build/draw_nef_s2+0x1e6471) #7 https://github.com/CGAL/cgal/pull/7 0x559e024b0add in CGAL::generic_sweep<CGAL::stl_seg_overlay_traits<std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SMO_from_segs<CGAL::SM_overlayer<CGAL::SM_decorator<CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SM_items, bool> > >, std::_List_iterator<CGAL::Sphere_segment<CGAL::Simple_cartesianCGAL::Gmpq > , CGAL::Positive_halfsphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq > ::sweep() (/home/gimeno/CGAL/Nef_S2/examples/build/draw_nef_s2+0x1caadd) #8 https://github.com/CGAL/cgal/pull/8 0x559e024a1c89 in void CGAL::SM_overlayer<CGAL::SM_decorator<CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq , CGAL::SM_items, bool> > ::create_from_circles<std::_List_iterator<CGAL::Sphere_circle<CGAL::Simple_cartesianCGAL::Gmpq
(std::_List_iterator<CGAL::Sphere_circle<CGAL::Simple_cartesianCGAL::Gmpq
, std::_List_iterator<CGAL::Sphere_circle<CGAL::Simple_cartesianCGAL::Gmpq > ) (/home/gimeno/CGAL/Nef_S2/examples/build/draw_nef_s2+0x1bbc89) #9 https://github.com/CGAL/cgal/pull/9 0x559e0249bd4d in CGAL::Nef_polyhedron_S2<CGAL::Simple_cartesianCGAL::Gmpq, CGAL::SM_items, bool, CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq >, CGAL::SM_items, bool> ::Nef_polyhedron_S2<std::_List_iterator<CGAL::Sphere_circle<CGAL::Simple_cartesianCGAL::Gmpq
(std::_List_iterator<CGAL::Sphere_circle<CGAL::Simple_cartesianCGAL::Gmpq
, std::_List_iterator<CGAL::Sphere_circle<CGAL::Simple_cartesianCGAL::Gmpq > , double) (/home/gimeno/CGAL/Nef_S2/examples/build/draw_nef_s2+0x1b5d4d) #10 https://github.com/CGAL/cgal/pull/10 0x559e024978b7 in void CGAL::create_random_Nef_S2<CGAL::Simple_cartesianCGAL::Gmpq, CGAL::SM_items, bool>(CGAL::Nef_polyhedron_S2<CGAL::Simple_cartesianCGAL::Gmpq, CGAL::SM_items, bool, CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq >, CGAL::SM_items, bool> >&, int, int) (/home/gimeno/CGAL/Nef_S2/examples/build/draw_nef_s2+0x1b18b7) #11 https://github.com/CGAL/cgal/pull/11 0x559e024880a2 in main (/home/gimeno/CGAL/Nef_S2/examples/build/draw_nef_s2+0x1a20a2) #12 https://github.com/CGAL/cgal/pull/12 0x7f70101c6b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #13 https://github.com/CGAL/cgal/pull/13 0x559e02487ad9 in _start (/home/gimeno/CGAL/Nef_S2/examples/build/draw_nef_s2+0x1a1ad9)
Address 0x7ffd86440390 is located in stack of thread T0 at offset 96 in frame #0 0x559e024a0c71 in void CGAL::SM_overlayer<CGAL::SM_decorator<CGAL::Sphere_map<CGAL::Sphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq
, CGAL::SM_items, bool> > ::create_from_circles<std::_List_iterator<CGAL::Sphere_circle<CGAL::Simple_cartesianCGAL::Gmpq
(std::_List_iterator<CGAL::Sphere_circle<CGAL::Simple_cartesianCGAL::Gmpq
, std::_List_iterator<CGAL::Sphere_circle<CGAL::Simple_cartesianCGAL::Gmpq > ) (/home/gimeno/CGAL/Nef_S2/examples/build/draw_nef_s2+0x1bac71)
This frame has 46 object(s): [32, 33) '' [96, 100) '' <== Memory access at offset 96 is inside this variable [160, 164) '' [224, 228) '' [288, 292) '' [352, 360) 'it' [416, 424) '' [480, 488) '' [544, 552) '' [608, 616) '' [672, 680) '' [736, 744) '' [800, 808) '' [864, 872) '' [928, 936) '' [992, 1000) '' [1056, 1064) '' [1120, 1128) '' [1184, 1192) '' [1248, 1256) 'v' [1312, 1320) 'e' [1376, 1384) '' [1440, 1448) '' [1504, 1512) '' [1568, 1576) '' [1632, 1640) '' [1696, 1704) '' [1760, 1768) 'u' [1824, 1832) '' [1888, 1896) 's' [1952, 1968) 'spair' [2016, 2032) '' [2080, 2096) '' [2144, 2288) 'From_input' [2336, 2360) 'L' [2400, 2424) 'L_pos' [2464, 2488) 'L_neg' [2528, 2560) '' [2592, 2624) '' [2656, 2688) '' [2720, 2752) '' [2784, 2816) '' [2848, 2880) '' [2912, 2952) 'O' [3008, 4384) 'SP' [4416, 5792) 'SM' HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext (longjmp and C++ exceptions are supported) SUMMARY: AddressSanitizer: stack-use-after-scope (/home/gimeno/CGAL/Nef_S2/examples/build/draw_nef_s2+0x1f50af) in CGAL::Positive_halfsphere_geometry<CGAL::Simple_cartesianCGAL::Gmpq
::compare_xy(CGAL::Sphere_point<CGAL::Simple_cartesianCGAL::Gmpq > const&, CGAL::Sphere_point<CGAL::Simple_cartesianCGAL::Gmpq > const&) const Shadow bytes around the buggy address: 0x100030c80020: f2 f2 00 00 00 f2 f2 f2 f2 f2 00 00 00 f2 f2 f2 0x100030c80030: f2 f2 00 00 00 f2 f2 f2 f2 f2 00 00 00 f2 f2 f2 0x100030c80040: f2 f2 00 00 00 f2 f2 f2 f2 f2 00 00 00 00 f3 f3 0x100030c80050: f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x100030c80060: 00 00 00 00 00 00 f1 f1 f1 f1 f8 f2 f2 f2 f2 f2 =>0x100030c80070: f2 f2[f8]f2 f2 f2 f2 f2 f2 f2 04 f2 f2 f2 f2 f2 0x100030c80080: f2 f2 04 f2 f2 f2 f2 f2 f2 f2 04 f2 f2 f2 f2 f2 0x100030c80090: f2 f2 00 f2 f2 f2 f2 f2 f2 f2 f8 f2 f2 f2 f2 f2 0x100030c800a0: f2 f2 f8 f2 f2 f2 f2 f2 f2 f2 f8 f2 f2 f2 f2 f2 0x100030c800b0: f2 f2 f8 f2 f2 f2 f2 f2 f2 f2 f8 f2 f2 f2 f2 f2 0x100030c800c0: f2 f2 f8 f2 f2 f2 f2 f2 f2 f2 f8 f2 f2 f2 f2 f2 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==11859==ABORTING
Apparently, conpare_xy() is called on a point that has been destroyed.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/CGAL/cgal/pull/3511#issuecomment-445212380, or mute the thread https://github.com/notifications/unsubscribe-auth/AAepk8OTM1L_wHJHPNsX0pd-ZcigM_W1ks5u2ljTgaJpZM4Y_YWF .
For me it's just that trying to access an invalid address is a very unstable operation, that shouldn't ever work, but as long as the memory has not been re-allocated, it is still there, so it doesn't crash. From here, moving anything can lead to altering this memory, and lead to a segfault.
I am pretty sure this happens in SM_Overlayer but I am not familiar enough with the core of the algorithm to identify what is happenning. I suspect some part of the algorithm relying on the reference counting in some types when deleting iterators but I cannot pinpoint it.
I tried with Simple_homogeneous<Exact_integer>, Homogeneous<Exact_integer>, Cartesian<mpq_class>, Simple_cartesian<mpq_class>, Cartesian<Exact_rational> and Simple_cartesian<Exact_rational>. Only Simple_cartesian<Exact_rational> exhibits the issue on my system.
On my machine, the sanitizer error is still triggered even with Cartesian<exact_rational>