[geos-devel] pip-performance merge bug

Sandro Santilli strk at kbt.io
Tue Jun 11 23:47:14 PDT 2019


On Tue, Jun 11, 2019 at 04:52:28PM -0700, git at osgeo.org wrote:

[...]

> commit f378ac5348002ce611a360eaf59a8bb281ecfa7b
> Author: Daniel Baston <dbaston at gmail.com>
> Date:   Mon Jun 10 15:09:56 2019 -0400
> 
>     Avoid relying on numeric ordering of Location
> 

[...]

>  
> -        max_loc = std::max(max_loc, loc);
> -        if (max_loc == geom::Location::EXTERIOR) {
> -            found = true;
> +        if (outermost_loc == Location::UNDEF || outermost_loc == Location::INTERIOR) {
> +            outermost_loc = loc;
> +        } else if (Location::EXTERIOR) {
> +            outermost_loc = loc;
> +            done = true;
>          }
>      }

The final "else if" condition will always be true (or false, depending
on the value of Location::EXTERIOR constant). I'm concerned that no
test failed with that bug in place, so if there's anything you can do
to trigger such bug it'd be great to add a test for it.

NOTE: my compiler (gcc 7.3.0) did catch it:

  .../src/geom/prep/PreparedPolygonPredicate.cpp:101:38: warning: enum constant in boolean context [-Wint-in-bool-context]
          } else if (Location::EXTERIOR) {
                     ^

--strk;



More information about the geos-devel mailing list