octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #61711] Test errors for sorting NaN values on


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #61711] Test errors for sorting NaN values on Windows with visibility flags
Date: Tue, 1 Nov 2022 11:41:36 -0400 (EDT)

Follow-up Comment #7, bug #61711 (project octave):

Apparently, which symbols are needed to be imported depends on how
aggressively the compiler optimizes the code. The patch from comment #6 was
enough when building with `-O2` (our default).

When I build with `-O0`, linking fails with these missing symbols:

  CXXLD    libinterp/liboctinterp.la
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/12.2.0/../../../../i686-w64-mingw32/bin/ld.exe:
libinterp\template-inst\.libs\liboctinterp_la-Array-tc.o: in function
`ZN16rec_index_helperC1ERK10dim_vectorRK5ArrayIN6octave10idx_vectorENSt3pmr21polymorphic_allocatorIS5_EEE':
D:\Octave-mingw32\.build/../liboctave/array/Array.cc:546: undefined reference
to `Array<octave::idx_vector,
std::pmr::polymorphic_allocator<octave::idx_vector> >::operator()(int) const'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/12.2.0/../../../../i686-w64-mingw32/bin/ld.exe:
D:\Octave-mingw32\.build/../liboctave/array/Array.cc:551: undefined reference
to `Array<octave::idx_vector,
std::pmr::polymorphic_allocator<octave::idx_vector> >::operator()(int) const'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/12.2.0/../../../../i686-w64-mingw32/bin/ld.exe:
D:\Octave-mingw32\.build/../liboctave/array/Array.cc:560: undefined reference
to `Array<octave::idx_vector,
std::pmr::polymorphic_allocator<octave::idx_vector> >::operator()(int) const'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/12.2.0/../../../../i686-w64-mingw32/bin/ld.exe:
libinterp\template-inst\.libs\liboctinterp_la-Array-tc.o: in function
`ZNK5ArrayI12octave_valueNSt3pmr21polymorphic_allocatorIS0_EEE5indexERKS_IN6octave10idx_vectorENS2_IS6_EEE':
D:\Octave-mingw32\.build/../liboctave/array/Array.cc:860: undefined reference
to `Array<octave::idx_vector,
std::pmr::polymorphic_allocator<octave::idx_vector> >::operator()(int) const'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/12.2.0/../../../../i686-w64-mingw32/bin/ld.exe:
D:\Octave-mingw32\.build/../liboctave/array/Array.cc:862: undefined reference
to `Array<octave::idx_vector,
std::pmr::polymorphic_allocator<octave::idx_vector> >::operator()(int) const'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/12.2.0/../../../../i686-w64-mingw32/bin/ld.exe:
libinterp\template-inst\.libs\liboctinterp_la-Array-tc.o:
D:\Octave-mingw32\.build/../liboctave/array/Array.cc:862: more undefined
references to `Array<octave::idx_vector,
std::pmr::polymorphic_allocator<octave::idx_vector> >::operator()(int) const'
follow
collect2.exe: error: ld returned 1 exit status


Linking succeeds when I move the definition of these (and other similar)
operators and functions from the header:

diff -r fa025af77216 liboctave/array/Array.cc
--- a/liboctave/array/Array.cc  Tue Nov 01 12:19:33 2022 +0100
+++ b/liboctave/array/Array.cc  Tue Nov 01 16:39:53 2022 +0100
@@ -253,6 +253,50 @@
 }
 
 template <typename T, typename Alloc>
+T&
+Array<T, Alloc>::elem (octave_idx_type n)
+{
+  make_unique ();
+  return xelem (n);
+}
+
+template <typename T, typename Alloc>
+T&
+Array<T, Alloc>::elem (octave_idx_type i, octave_idx_type j)
+{ return elem (dim1 ()*j+i); }
+
+template <typename T, typename Alloc>
+T&
+Array<T, Alloc>::elem (octave_idx_type i, octave_idx_type j, octave_idx_type
k)
+{ return elem (i, dim2 ()*k+j); }
+
+template <typename T, typename Alloc>
+T&
+Array<T, Alloc>::elem (const Array<octave_idx_type>& ra_idx)
+{ return Array<T, Alloc>::elem (compute_index_unchecked (ra_idx)); }
+
+template <typename T, typename Alloc>
+T&
+Array<T, Alloc>::operator () (octave_idx_type n)
+{ return elem (n); }
+
+template <typename T, typename Alloc>
+T&
+Array<T, Alloc>::operator () (octave_idx_type i, octave_idx_type j)
+{ return elem (i, j); }
+
+template <typename T, typename Alloc>
+T&
+Array<T, Alloc>::operator () (octave_idx_type i, octave_idx_type j,
+                              octave_idx_type k)
+{ return elem (i, j, k); }
+
+template <typename T, typename Alloc>
+T&
+Array<T, Alloc>::operator () (const Array<octave_idx_type>& ra_idx)
+{ return elem (ra_idx); }
+
+template <typename T, typename Alloc>
 typename Array<T, Alloc>::crefT
 Array<T, Alloc>::checkelem (octave_idx_type n) const
 {
@@ -288,6 +332,47 @@
 }
 
 template <typename T, typename Alloc>
+typename Array<T, Alloc>::crefT
+Array<T, Alloc>::elem (octave_idx_type n) const
+{ return xelem (n); }
+
+template <typename T, typename Alloc>
+typename Array<T, Alloc>::crefT
+Array<T, Alloc>::elem (octave_idx_type i, octave_idx_type j) const
+{ return xelem (i, j); }
+
+template <typename T, typename Alloc>
+typename Array<T, Alloc>::crefT
+Array<T, Alloc>::elem (octave_idx_type i, octave_idx_type j, octave_idx_type
k) const
+{ return xelem (i, j, k); }
+
+template <typename T, typename Alloc>
+typename Array<T, Alloc>::crefT
+Array<T, Alloc>::elem (const Array<octave_idx_type>& ra_idx) const
+{ return Array<T, Alloc>::xelem (compute_index_unchecked (ra_idx)); }
+
+template <typename T, typename Alloc>
+typename Array<T, Alloc>::crefT
+Array<T, Alloc>::operator () (octave_idx_type n) const
+{ return elem (n); }
+
+template <typename T, typename Alloc>
+typename Array<T, Alloc>::crefT
+Array<T, Alloc>::operator () (octave_idx_type i, octave_idx_type j) const
+{ return elem (i, j); }
+
+template <typename T, typename Alloc>
+typename Array<T, Alloc>::crefT
+Array<T, Alloc>::operator () (octave_idx_type i, octave_idx_type j,
+                              octave_idx_type k) const
+{ return elem (i, j, k); }
+
+template <typename T, typename Alloc>
+typename Array<T, Alloc>::crefT
+Array<T, Alloc>::operator () (const Array<octave_idx_type>& ra_idx) const
+{ return elem (ra_idx); }
+
+template <typename T, typename Alloc>
 Array<T, Alloc>
 Array<T, Alloc>::column (octave_idx_type k) const
 {
diff -r fa025af77216 liboctave/array/Array.h
--- a/liboctave/array/Array.h   Tue Nov 01 12:19:33 2022 +0100
+++ b/liboctave/array/Array.h   Tue Nov 01 16:39:53 2022 +0100
@@ -526,26 +526,23 @@
 
   OCTARRAY_API T& checkelem (const Array<octave_idx_type>& ra_idx);
 
-  T& elem (octave_idx_type n)
-  {
-    make_unique ();
-    return xelem (n);
-  }
+  OCTARRAY_API T& elem (octave_idx_type n);
+
+  OCTARRAY_API T& elem (octave_idx_type i, octave_idx_type j);
 
-  T& elem (octave_idx_type i, octave_idx_type j) { return elem (dim1 ()*j+i);
}
+  OCTARRAY_API T& elem (octave_idx_type i, octave_idx_type j,
+                        octave_idx_type k);
+
+  OCTARRAY_API T& elem (const Array<octave_idx_type>& ra_idx);
 
-  T& elem (octave_idx_type i, octave_idx_type j, octave_idx_type k)
-  { return elem (i, dim2 ()*k+j); }
+  OCTARRAY_API T& operator () (octave_idx_type n);
 
-  T& elem (const Array<octave_idx_type>& ra_idx)
-  { return Array<T, Alloc>::elem (compute_index_unchecked (ra_idx)); }
+  OCTARRAY_API T& operator () (octave_idx_type i, octave_idx_type j);
 
-  T& operator () (octave_idx_type n) { return elem (n); }
-  T& operator () (octave_idx_type i, octave_idx_type j) { return elem (i, j);
}
-  T& operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k)
-  { return elem (i, j, k); }
-  T& operator () (const Array<octave_idx_type>& ra_idx)
-  { return elem (ra_idx); }
+  OCTARRAY_API T& operator () (octave_idx_type i, octave_idx_type j,
+                               octave_idx_type k);
+
+  OCTARRAY_API T& operator () (const Array<octave_idx_type>& ra_idx);
 
   OCTARRAY_API crefT checkelem (octave_idx_type n) const;
 
@@ -556,25 +553,23 @@
 
   OCTARRAY_API crefT checkelem (const Array<octave_idx_type>& ra_idx) const;
 
-  crefT elem (octave_idx_type n) const { return xelem (n); }
+  OCTARRAY_API crefT elem (octave_idx_type n) const;
+
+  OCTARRAY_API crefT elem (octave_idx_type i, octave_idx_type j) const;
 
-  crefT elem (octave_idx_type i, octave_idx_type j) const
-  { return xelem (i, j); }
+  OCTARRAY_API crefT elem (octave_idx_type i, octave_idx_type j,
+                           octave_idx_type k) const;
 
-  crefT elem (octave_idx_type i, octave_idx_type j, octave_idx_type k) const
-  { return xelem (i, j, k); }
+  OCTARRAY_API crefT elem (const Array<octave_idx_type>& ra_idx) const;
 
-  crefT elem (const Array<octave_idx_type>& ra_idx) const
-  { return Array<T, Alloc>::xelem (compute_index_unchecked (ra_idx)); }
+  OCTARRAY_API crefT operator () (octave_idx_type n) const;
+
+  OCTARRAY_API crefT operator () (octave_idx_type i, octave_idx_type j)
const;
 
-  crefT operator () (octave_idx_type n) const { return elem (n); }
-  crefT operator () (octave_idx_type i, octave_idx_type j) const
-  { return elem (i, j); }
-  crefT operator () (octave_idx_type i, octave_idx_type j,
-                     octave_idx_type k) const
-  { return elem (i, j, k); }
-  crefT operator () (const Array<octave_idx_type>& ra_idx) const
-  { return elem (ra_idx); }
+  OCTARRAY_API crefT operator () (octave_idx_type i, octave_idx_type j,
+                                  octave_idx_type k) const;
+
+  OCTARRAY_API crefT operator () (const Array<octave_idx_type>& ra_idx)
const;
 
   // Fast extractors.  All of these produce shallow copies.
 


Do we want to do that?



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?61711>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]