[3dprinter-general] Bug#1037614: cura-engine: ftbfs with GCC-13

Gregor Riepl onitake at gmail.com
Sat Jul 22 17:58:15 BST 2023

So, I investigated where the second issue 
(PolygonConnectorTest.getBridgeNestedSquares) is coming from, and found 
another case where tiny precision problems lead to off-by-one rounding 
errors. In this case, the end result is much more severe than in 
IntPointTest.TestRotationMatrix, because many errors accumulate and lead 
to a big difference.

After adding more llrint() rounding in the right places, the unit tests 
no longer fail on i686, while still producing correct results on amd64.

I'm inclined to push the patch (attached) as it is and not gate it with 
#ifdef __i386__. The explicit rounding has no impact on performance on 
amd64/SSE, because the truncating conversion function (cvttsd2si) has 
the same performance as the rounding conversion function (cvtsd2si).
On the FPU, there is a slight penalty, because the rounding mode needs 
to be loaded into the FPU control register first.

As an added bonus, I added a rounding fix for the original issue 
reported in https://github.com/Ultimaker/CuraEngine/issues/1192 - this 
was actually in the unit test itself. With this fix, the patch 
1001-relax-test.patch can be dropped.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0017-Round-from-double-to-cInt-explicitly-when-applying-m.patch
Type: text/x-patch
Size: 3266 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/3dprinter-general/attachments/20230722/ab07c78a/attachment.bin>

More information about the 3dprinter-general mailing list