Opened 3 years ago

Closed 3 years ago

#5004 closed defect (fixed)

ptarray_closest_segment2d fails on 32bit (sometimes)

Reported by: strk Owned by: pramsey
Priority: medium Milestone: PostGIS 3.2.0
Component: postgis Version: master
Keywords: Cc:

Description

I've added a test for ptarray_closest_segment_2d in [894916e50a63091b8c7e5fb641892379eda559c7/git] which is passing in gitlab-ci test32 but failing on my own 32bit chroot.

The test invokes the function with an L-shaped linestring and a point collinear with on of the two segments, and closest to the common vertex.

One would expect (and the test expects) that the "closest segment" found is the first one, as the actual closest point is the shared vertex, but under some circumstances, on a 32bit system, the code finds the second segment to be "closer" than the first one.

By "some circumstances" I also mean *printing* or not the distance values as found, so this screams "number of bits used for computation", using registers or not, optimization used or not.

I'm not sure what to do with this ticket, but if we want to GUARANTEE that the earliest segment is returned, when the closest point is a vertex, then we need some action here, other than disabling the test.

Change History (1)

comment:1 by Sandro Santilli <strk@…>, 3 years ago

Resolution: fixed
Status: newclosed

In f09d08e/git:

Avoid testing corner case with closest_segment_2d

Closes #5004

Note: See TracTickets for help on using tickets.