[geos-devel] [GEOS] #1104: error: conversion from 'std::size_t' {aka 'long long unsigned int'} to 'long int' may change value [-Werror=conversion]

GEOS geos-trac at osgeo.org
Tue Mar 2 13:25:20 PST 2021


#1104: error: conversion from 'std::size_t' {aka 'long long unsigned int'} to
'long int' may change value [-Werror=conversion]
------------------------+--------------------------
 Reporter:  robe        |      Owner:  geos-devel@…
     Type:  defect      |     Status:  new
 Priority:  major       |  Milestone:  3.10.0
Component:  Default     |    Version:  master
 Severity:  Unassigned  |   Keywords:
------------------------+--------------------------
 Seeing this error on winnie's gcc 8.1 64-bit builds.  Strk says he is
 seeing the same errors.
 This is with cmake 3.15.4.  I'm going to up it and see if things improve.
 {{{

 -- GEOS: Build type: Release
 -- GEOS: Run-time output: E:/jenkins/geos/branches/build64cmake3.10/bin
 -- GEOS: Archives output: E:/jenkins/geos/branches/build64cmake3.10/lib
 -- The C compiler identification is GNU 8.1.0
 -- The CXX compiler identification is GNU 8.1.0
 -- Check for working C compiler: C:/ming64gcc81/mingw64/bin/gcc.exe
 -- Check for working C compiler: C:/ming64gcc81/mingw64/bin/gcc.exe --
 works
 -- Detecting C compiler ABI info
 -- Detecting C compiler ABI info - done
 -- Detecting C compile features
 -- Detecting C compile features - done
 -- Check for working CXX compiler: C:/ming64gcc81/mingw64/bin/g++.exe
 -- Check for working CXX compiler: C:/ming64gcc81/mingw64/bin/g++.exe --
 works
 -- Detecting CXX compiler ABI info
 -- Detecting CXX compiler ABI info - done
 -- Detecting CXX compile features
 -- Detecting CXX compile features - done
 -- GEOS: Version 3.10.0dev
 -- GEOS: C API Version 1.15.0
 -- GEOS: JTS port 1.17.0
 -- GEOS: Require C++11
 -- GEOS: Function inlining ENABLED
 -- GEOS: Developer mode ENABLED
 -- GEOS: Configured 'dist' target
 -- GEOS: Configured 'distcheck' target
 -- Configuring done
 -- Generating done

 [ 98%] Building CXX object
 util/geosop/CMakeFiles/geosop.dir/GeosOp.cpp.obj
 E:/jenkins/geos/branches/3.10cmake/util/geosop/GeosOp.cpp: In function
 'bool isWKTLiteral(std::__cxx11::string)':
 E:/jenkins/geos/branches/3.10cmake/util/geosop/GeosOp.cpp:171:32: error:
 conversion from
 'std::__iterator_traits<__gnu_cxx::__normal_iterator<char*,
 std::__cxx11::basic_string<char> >, void>::difference_type' {aka 'long
 long int'} to 'long int' may change value [-Werror=conversion]
      long numLParen = std::count(s.begin(), s.end(), '(');
                       ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
 E:/jenkins/geos/branches/3.10cmake/util/geosop/GeosOp.cpp: In member
 function 'void GeosOp::executeUnary(GeomFunction*)':
 E:/jenkins/geos/branches/3.10cmake/util/geosop/GeosOp.cpp:355:47: error:
 conversion from 'std::size_t' {aka 'long long unsigned int'} to 'long int'
 may change value [-Werror=conversion]
          vertexCount += geomA[i]->getNumPoints();
                                                ^
 E:/jenkins/geos/branches/3.10cmake/util/geosop/GeosOp.cpp: In member
 function 'void GeosOp::executeBinary(GeomFunction*)':
 E:/jenkins/geos/branches/3.10cmake/util/geosop/GeosOp.cpp:366:52: error:
 conversion from 'std::size_t' {aka 'long long unsigned int'} to 'long int'
 may change value [-Werror=conversion]
              vertexCount += geomA[ia]->getNumPoints();
                                                     ^
 E:/jenkins/geos/branches/3.10cmake/util/geosop/GeosOp.cpp:367:52: error:
 conversion from 'std::size_t' {aka 'long long unsigned int'} to 'long int'
 may change value [-Werror=conversion]
              vertexCount += geomB[ib]->getNumPoints();
                                                     ^
 At global scope:
 cc1plus.exe: error: unrecognized command line option '-Wno-unknown-
 warning-option' [-Werror]
 cc1plus.exe: all warnings being treated as errors
 make[2]: *** [util/geosop/CMakeFiles/geosop.dir/build.make:64:
 util/geosop/CMakeFiles/geosop.dir/GeosOp.cpp.obj] Error 1
 make[1]: *** [CMakeFiles/Makefile2:1962:
 util/geosop/CMakeFiles/geosop.dir/all] Error 2
 make: *** [Makefile:163: all] Error 2
 }}}



 I'm seeing a bunch of errors on 32-bit but will look at those closer

-- 
Ticket URL: <https://trac.osgeo.org/geos/ticket/1104>
GEOS <http://trac.osgeo.org/geos>
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite (JTS).


More information about the geos-devel mailing list