Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applying Construct_center_3 on a Circle_3 object causes segmentation fault #8578

Open
efifogel opened this issue Oct 28, 2024 · 0 comments · May be fixed by #8586
Open

Applying Construct_center_3 on a Circle_3 object causes segmentation fault #8578

efifogel opened this issue Oct 28, 2024 · 0 comments · May be fixed by #8586

Comments

@efifogel
Copy link
Member

efifogel commented Oct 28, 2024

Here is a simple program that generates the issue:

#include <iostream>
#include <CGAL/Cartesian.h>
int main() {
  using Kernel = CGAL::Cartesian<double>;
  Kernel kernel;
  auto ctr = kernel.construct_center_3_object();
  Kernel::Point_3 p(0,1,2);

  Kernel::Sphere_3 s(p,1);
  const auto b = ctr(s);
  std::cout << "Sphere center: " << b << std::endl;

  Kernel::Vector_3 v(0,0,1);
  Kernel::Circle_3 c(p,1,v);
  const auto a = ctr(c);
  std::cout << "Circle center: " << a << std::endl;

  return 0;
}

As a matter of fact, I also get a warning during compilation:

/home/efif/trees/cgal/cgal_master/Kernel_23/include/CGAL/Kernel/function_objects.h: In instantiation of ‘const Point_3& CGAL::CommonKernelFunctors::Construct_center_3<K>::operator()(const Circle_3&) const [with K = CGAL::Cartesian<double>; CGAL::CommonKernelFunctors::Construct_center_3<K>::result_type = const CGAL::Point_3<CGAL::Cartesian<double> >&; CGAL::CommonKernelFunctors::Construct_center_3<K>::Circle_3 = CGAL::Circle_3<CGAL::Cartesian<double> >]’:
/home/efif/tmp/cgal/test/test.cpp:15:21:   required from here
/home/efif/trees/cgal/cgal_master/Kernel_23/include/CGAL/Kernel/function_objects.h:1559:29: warning: returning reference to temporary [-Wreturn-local-addr]
 1559 |     { return c.rep().center(); }
      |                             ^
@MaelRL MaelRL self-assigned this Nov 3, 2024
@MaelRL MaelRL added this to the 5.6.3 milestone Nov 3, 2024
@MaelRL MaelRL linked a pull request Nov 3, 2024 that will close this issue
@MaelRL MaelRL linked a pull request Nov 3, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants