From 040af5fa98a493357c1e695cb313deff8b59f817 Mon Sep 17 00:00:00 2001 From: Joshua Wise Date: Sun, 22 Jan 2023 01:52:18 -0500 Subject: [PATCH] slic3r: address sanitizer cleanup in TreeSupport::generate_contact_points In generate_contact_points, the rotated_dims don't actually generate a Point, but generate an abstract expression that holds a reference to bounding_box_size. Unfortunately, this goes wrong because bounding_box_size ages out instantly; GCC's Address Sanitizer complains that this is a "stack-use-after-scope" issue. Interestingly, the Eigen documentation says that this is a known problem with using C++11 "auto" to generate matrices (which a Point is)! It is buried here: https://eigen.tuxfamily.org/dox/TopicPitfalls.html This is probably an extremely theoretical correctness improvement, and also an extremely theoretical performance improvement. But it is an improvement nonetheless, and, more importantly, it enables me to continue to run the slicer with Address Sanitizer turned on to find other potential issues. --- src/libslic3r/TreeSupport.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libslic3r/TreeSupport.cpp b/src/libslic3r/TreeSupport.cpp index 0aa517826..70d0b6eb8 100644 --- a/src/libslic3r/TreeSupport.cpp +++ b/src/libslic3r/TreeSupport.cpp @@ -3330,7 +3330,7 @@ void TreeSupport::generate_contact_points(std::vector