bugGNU Octave - Bugs: bug #60884, [octave forge] (geometry) Compile...

 
 

bug #60884: [octave forge] (geometry) Compile with g++ v11

Submitter:  Rafael Laboissière <rlaboiss>
Submitted:  Tue 06 Jul 2021 08:38:43 AM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Build Failure
Status:  Fixed Assigned to:  juanpi
Originator Name:  Open/Closed:  * Closed
Release:  * other Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 16 Mar 2024 10:57:18 PM UTC, comment #8: 

I have pushed Dmitri's suggestion. Also fixed some file encoding that were causing errors.

closing.

Juan Pablo Carbajal <juanpi>
Group Member
Sat 16 Mar 2024 07:08:48 PM UTC, comment #7: 
Dmitri A. Sergatskov <dasergatskov>
Sat 16 Mar 2024 07:02:02 PM UTC, comment #6: 


comment #5:

>
> @Dmitri: could you open a different bug regarding the failing test?
>


https://savannah.gnu.org/bugs/index.php?65466

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Sat 16 Mar 2024 11:44:05 AM UTC, comment #5: 

Can anyone test if the change proposed by Dmitri is ok?
CCing function developer.

@Dmitri: could you open a different bug regarding the failing test?

Juan Pablo Carbajal <juanpi>
Group Member
Mon 29 May 2023 10:34:02 PM UTC, comment #4: 

This change removes warning for me:

@@ -747,7 +747,7 @@

 inline void InitEdge(TEdge* e, TEdge* eNext, TEdge* ePrev, const IntPoint& Pt)
 {
-  std::memset(e, 0, sizeof(TEdge));
+  *e = {};
   e->Next = eNext;
   e->Prev = ePrev;
   e->Curr = Pt;


but I am not C++ expert, perhaps I am missing something.
"pkg test geometry" fails for me (with or without this change) at


octave:2> test joinPolygons verbose
>>>>> /home/dima/.local/share/octave/api-v58/packages/geometry-4.0.0/joinPolygons.m
***** test
 assert (joinPolygons ({1,2}), [1 2]);
***** test
 assert (joinPolygons ({}), []);
***** test
 XY = joinPolygons ({[1 6; 2 5; 3 4]; [4 3; 5 2; 6 1]});
 assert (XY, [1 6; 2 5; 3 4; NaN NaN; 4 3; 5 2; 6 1]);
***** error <joinPolygons: cell array expected> joinPolygons ([1 2 NaN 3 4], [56 NaN 78])
!!!!! error failed.
Expected <joinPolygons: cell array expected>, but got <joinPolygons: function called with too many inputs>


Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Mon 29 May 2023 09:17:47 PM UTC, comment #3: 

4.0.1 release (with this patch), please ?

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Wed 07 Jul 2021 09:57:34 PM UTC, comment #2: 

Tested on my side. The reported erro is fixed, there remains a warning


> pkg install geometry-4.0.1.tar.gz
clipper.cpp: In function ‘void ClipperLib::InitEdge(ClipperLib::TEdge*, ClipperLib::TEdge*, ClipperLib::TEdge*, const ClipperLib::IntPoint&)’:
clipper.cpp:750:34: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘struct ClipperLib::TEdge’; use assignment or value-initialization instead [-Wclass-memaccess]
  750 |   std::memset(e, 0, sizeof(TEdge));
      |                                  ^
clipper.cpp:95:8: note: ‘struct ClipperLib::TEdge’ declared here
   95 | struct TEdge {
      |        ^~~~~
warning: doc_cache_create: unusable help text found in file 'clipper'
warning: called from
    doc_cache_create>handle_function at line 98 column 5
    doc_cache_create>create_cache at line 118 column 36
    gen_doc_cache_in_dir>@<anonymous> at line 150 column 16
    doc_cache_create>gen_doc_cache_in_dir at line 151 column 9
    doc_cache_create at line 62 column 12
    install>generate_lookfor_cache at line 840 column 5
    install at line 241 column 7
    pkg at line 570 column 9

For information about changes from previous versions of the geometry package, run 'news geometry'.


Juan Pablo Carbajal <juanpi>
Group Member
Wed 07 Jul 2021 09:23:52 PM UTC, comment #1: 

I applied the patch into the default branch change set 04965cda30b5

https://sourceforge.net/p/octave/geometry/ci/04965cda30b5f9e51774194c67879e7336df1710/


Juan Pablo Carbajal <juanpi>
Group Member
Tue 06 Jul 2021 08:38:43 AM UTC, original submission:  

Compilation of the geometry package against g++ 11 fails with the following error messages:


mkoctfile -c martinez.cpp -o martinez.o
In file included from /usr/include/c++/11/set:60,
                 from martinez.h:19,
                 from martinez.cpp:9:
/usr/include/c++/11/bits/stl_tree.h: In instantiation of ‘static const _Key& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_S_key(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Const_Link_type) [with _Key = Martinez::SweepEvent*; _Val = Martinez::SweepEvent*; _KeyOfValue = std::_Identity<Martinez::SweepEvent*>; _Compare = Martinez::SegmentComp; _Alloc = std::allocator<Martinez::SweepEvent*>; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Const_Link_type = const std::_Rb_tree_node<Martinez::SweepEvent*>*]’:
/usr/include/c++/11/bits/stl_tree.h:2069:47:   required from ‘std::pair<std::_Rb_tree_node_base*, std::_Rb_tree_node_base*> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_unique_pos(const key_type&) [with _Key = Martinez::SweepEvent*; _Val = Martinez::SweepEvent*; _KeyOfValue = std::_Identity<Martinez::SweepEvent*>; _Compare = Martinez::SegmentComp; _Alloc = std::allocator<Martinez::SweepEvent*>; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::key_type = Martinez::SweepEvent*]’
/usr/include/c++/11/bits/stl_tree.h:2122:4:   required from ‘std::pair<std::_Rb_tree_iterator<_Val>, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(_Arg&&) [with _Arg = Martinez::SweepEvent* const&; _Key = Martinez::SweepEvent*; _Val = Martinez::SweepEvent*; _KeyOfValue = std::_Identity<Martinez::SweepEvent*>; _Compare = Martinez::SegmentComp; _Alloc = std::allocator<Martinez::SweepEvent*>]’
/usr/include/c++/11/bits/stl_set.h:512:25:   required from ‘std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = Martinez::SweepEvent*; _Compare = Martinez::SegmentComp; _Alloc = std::allocator<Martinez::SweepEvent*>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<Martinez::SweepEvent*, Martinez::SweepEvent*, std::_Identity<Martinez::SweepEvent*>, Martinez::SegmentComp, std::allocator<Martinez::SweepEvent*> >::const_iterator; typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<_Key>::other = std::allocator<Martinez::SweepEvent*>; typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<_Key> = __gnu_cxx::__alloc_traits<std::allocator<Martinez::SweepEvent*>, Martinez::SweepEvent*>::rebind<Martinez::SweepEvent*>; typename _Allocator::value_type = Martinez::SweepEvent*; std::set<_Key, _Compare, _Alloc>::value_type = Martinez::SweepEvent*]’
martinez.cpp:137:27:   required from here
/usr/include/c++/11/bits/stl_tree.h:770:15: error: static assertion failed: comparison object must be invocable as const
  770 |               is_invocable_v<const _Compare&, const _Key&, const _Key&>,
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/stl_tree.h:770:15: note: ‘std::is_invocable_v<const Martinez::SegmentComp&, Martinez::SweepEvent* const&, Martinez::SweepEvent* const&>’ evaluates to false
make: *** [Makefile:15: martinez.o] Error 1
mkoctfile -c polygon.cpp -o polygon.o
In file included from /usr/include/c++/11/set:60,
                 from polygon.cpp:12:
/usr/include/c++/11/bits/stl_tree.h: In instantiation of ‘static const _Key& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_S_key(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Const_Link_type) [with _Key = {anonymous}::SweepEvent*; _Val = {anonymous}::SweepEvent*; _KeyOfValue = std::_Identity<{anonymous}::SweepEvent*>; _Compare = {anonymous}::SegmentComp; _Alloc = std::allocator<{anonymous}::SweepEvent*>; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Const_Link_type = const std::_Rb_tree_node<{anonymous}::SweepEvent*>*]’:
/usr/include/c++/11/bits/stl_tree.h:2069:47:   required from ‘std::pair<std::_Rb_tree_node_base*, std::_Rb_tree_node_base*> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_unique_pos(const key_type&) [with _Key = {anonymous}::SweepEvent*; _Val = {anonymous}::SweepEvent*; _KeyOfValue = std::_Identity<{anonymous}::SweepEvent*>; _Compare = {anonymous}::SegmentComp; _Alloc = std::allocator<{anonymous}::SweepEvent*>; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::key_type = {anonymous}::SweepEvent*]’
/usr/include/c++/11/bits/stl_tree.h:2122:4:   required from ‘std::pair<std::_Rb_tree_iterator<_Val>, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(_Arg&&) [with _Arg = {anonymous}::SweepEvent* const&; _Key = {anonymous}::SweepEvent*; _Val = {anonymous}::SweepEvent*; _KeyOfValue = std::_Identity<{anonymous}::SweepEvent*>; _Compare = {anonymous}::SegmentComp; _Alloc = std::allocator<{anonymous}::SweepEvent*>]’
/usr/include/c++/11/bits/stl_set.h:512:25:   required from ‘std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = {anonymous}::SweepEvent*; _Compare = {anonymous}::SegmentComp; _Alloc = std::allocator<{anonymous}::SweepEvent*>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<{anonymous}::SweepEvent*, {anonymous}::SweepEvent*, std::_Identity<{anonymous}::SweepEvent*>, {anonymous}::SegmentComp, std::allocator<{anonymous}::SweepEvent*> >::const_iterator; typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<_Key>::other = std::allocator<{anonymous}::SweepEvent*>; typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<_Key> = __gnu_cxx::__alloc_traits<std::allocator<{anonymous}::SweepEvent*>, {anonymous}::SweepEvent*>::rebind<{anonymous}::SweepEvent*>; typename _Allocator::value_type = {anonymous}::SweepEvent*; std::set<_Key, _Compare, _Alloc>::value_type = {anonymous}::SweepEvent*]’
polygon.cpp:208:22:   required from here
/usr/include/c++/11/bits/stl_tree.h:770:15: error: static assertion failed: comparison object must be invocable as const
  770 |               is_invocable_v<const _Compare&, const _Key&, const _Key&>,
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/stl_tree.h:770:15: note: ‘std::is_invocable_v<const {anonymous}::SegmentComp&, {anonymous}::SweepEvent* const&, {anonymous}::SweepEvent* const&>’ evaluates to false
make: *** [Makefile:15: polygon.o] Error 1


The patch attached to this bug report fixes the issues.

Rafael Laboissière <rlaboiss>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by juanpi
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by juanpi (Posted a comment)
  • -email is unavailable- added by rlaboiss (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-03-16 juanpi StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2024-03-16 juanpi Carbon-Copy- Added philipnienhuis
    2023-02-19 mmuetzel Dependencies- bugs #63817 is dependent
    2021-07-07 juanpi StatusNone Ready For Test
        Assigned toNone juanpi
    2021-07-06 rlaboiss Attached File- Added compile-with-g++-v11.patch, #51651

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code