Core, SparseCore, Tensor: Fix some CI compiler warnings

libeigen/eigen!3368

diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h
index ac16c37..1ff75fd 100644
--- a/Eigen/src/Core/GeneralProduct.h
+++ b/Eigen/src/Core/GeneralProduct.h
@@ -284,6 +284,11 @@
   EIGEN_DEVICE_FUNC constexpr Scalar* data() { return 0; }
 };
 
+template <typename Scalar, int Size>
+struct gemv_static_vector_if<Scalar, Size, 0, true> {
+  EIGEN_DEVICE_FUNC constexpr Scalar* data() { return nullptr; }
+};
+
 template <typename Scalar, int Size, int MaxSize>
 struct gemv_static_vector_if<Scalar, Size, MaxSize, true> {
 #if EIGEN_MAX_STATIC_ALIGN_BYTES != 0
diff --git a/Eigen/src/Core/MathFunctionsImpl.h b/Eigen/src/Core/MathFunctionsImpl.h
index 49cc703..c455059 100644
--- a/Eigen/src/Core/MathFunctionsImpl.h
+++ b/Eigen/src/Core/MathFunctionsImpl.h
@@ -295,7 +295,7 @@
   EIGEN_USING_STD(atan2);
   const T b = T(EIGEN_LOG2E) * atan2(z.imag(), z.real());
   if (EIGEN_PREDICT_FALSE((numext::isinf)(a) && (numext::isfinite)(z.real()) && (numext::isfinite)(z.imag()))) {
-    const T half(0.5);
+    const T half = T(0.5);
     return ComplexT(numext::log2(numext::abs(ComplexT(z.real() * half, z.imag() * half))) + T(1), b);
   }
   if (EIGEN_PREDICT_FALSE(a < (numext::numeric_limits<T>::min)() && !numext::is_exactly_zero(a))) {
diff --git a/Eigen/src/Core/MatrixNorms.h b/Eigen/src/Core/MatrixNorms.h
index b0b0102..8ad010e 100644
--- a/Eigen/src/Core/MatrixNorms.h
+++ b/Eigen/src/Core/MatrixNorms.h
@@ -310,6 +310,7 @@
   // lies outside the rows the two share.
   template <int Mode, typename Mat>
   RealScalar l1NormStreaming(const Mat& m) const {
+    EIGEN_IF_CONSTEXPR (Mat::MaxRowsAtCompileTime == 0) return RealScalar(0);
     const Index n = m.rows();
     // The accumulator lives in the object for bounded sizes and on the stack otherwise, so that
     // neither fixed-size nor preallocated dynamic-size decompositions allocate.
diff --git a/Eigen/src/Core/products/GeneralMatrixMatrix.h b/Eigen/src/Core/products/GeneralMatrixMatrix.h
index 529f7d0..8b93e6b 100644
--- a/Eigen/src/Core/products/GeneralMatrixMatrix.h
+++ b/Eigen/src/Core/products/GeneralMatrixMatrix.h
@@ -414,11 +414,11 @@
   static constexpr int SizeB = plain_enum_max(int(ActualCols) * MaxDepth, 1);
 
 #if EIGEN_MAX_STATIC_ALIGN_BYTES >= EIGEN_DEFAULT_ALIGN_BYTES
-  EIGEN_ALIGN_MAX LhsScalar m_staticA[SizeA];
-  EIGEN_ALIGN_MAX RhsScalar m_staticB[SizeB];
+  EIGEN_ALIGN_MAX LhsScalar m_staticA[SizeA > 0 ? SizeA : 1];
+  EIGEN_ALIGN_MAX RhsScalar m_staticB[SizeB > 0 ? SizeB : 1];
 #else
-  EIGEN_ALIGN_MAX char m_staticA[SizeA * sizeof(LhsScalar) + EIGEN_DEFAULT_ALIGN_BYTES - 1];
-  EIGEN_ALIGN_MAX char m_staticB[SizeB * sizeof(RhsScalar) + EIGEN_DEFAULT_ALIGN_BYTES - 1];
+  EIGEN_ALIGN_MAX char m_staticA[(SizeA > 0 ? SizeA : 1) * sizeof(LhsScalar) + EIGEN_DEFAULT_ALIGN_BYTES - 1];
+  EIGEN_ALIGN_MAX char m_staticB[(SizeB > 0 ? SizeB : 1) * sizeof(RhsScalar) + EIGEN_DEFAULT_ALIGN_BYTES - 1];
 #endif
 
  public:
diff --git a/Eigen/src/SparseCore/SparseMap.h b/Eigen/src/SparseCore/SparseMap.h
index b88e3ca..f6e9317 100644
--- a/Eigen/src/SparseCore/SparseMap.h
+++ b/Eigen/src/SparseCore/SparseMap.h
@@ -172,6 +172,8 @@
   enum { IsRowMajor = Base::IsRowMajor };
 
   using Base::operator=;
+  EIGEN_DEFAULT_COPY_CONSTRUCTOR(SparseMapBase)
+  SparseMapBase& operator=(const SparseMapBase&) = default;
 
  public:
   //----------------------------------------
diff --git a/contrib/test/structured_matrices.cpp b/contrib/test/structured_matrices.cpp
index 00ff71f..459160a 100644
--- a/contrib/test/structured_matrices.cpp
+++ b/contrib/test/structured_matrices.cpp
@@ -1561,7 +1561,8 @@
   VERIFY_IS_EQUAL(read_through_address(Operator::IsRowMajor), row_major);
 }
 
-static void test_structured_metadata_odr_use() {
+template <typename = void>
+void test_structured_metadata_odr_use() {
   structured_metadata_odr_use<Bccb<double, 2, 3>>(6, 6);
   structured_metadata_odr_use<Bccb<double>>(Dynamic, Dynamic);
   structured_metadata_odr_use<Cauchy<double, 4, 3>>(4, 3);
@@ -1593,7 +1594,7 @@
 }
 
 EIGEN_DECLARE_TEST(structured_matrices) {
-  CALL_SUBTEST_16(test_structured_metadata_odr_use());
+  CALL_SUBTEST_16(test_structured_metadata_odr_use<>());
   for (int i = 0; i < g_repeat; ++i) {
     // Circulant: direct path (small), FFT path (composite and prime sizes), edge cases.
     CALL_SUBTEST_1((test_circulant_product<double>(1)));
diff --git a/contrib/test/tensor_io.cpp b/contrib/test/tensor_io.cpp
index abb70cc..c4d59bf 100644
--- a/contrib/test/tensor_io.cpp
+++ b/contrib/test/tensor_io.cpp
@@ -7,6 +7,12 @@
 // Public License v. 2.0. If a copy of the MPL was not distributed
 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 // SPDX-License-Identifier: MPL-2.0
+
+#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 10
+// GCC loses nested initializer-list bounds after inlining small heap-allocated tensors.
+#pragma GCC diagnostic ignored "-Wstringop-overflow"
+#endif
+
 #include "main.h"
 
 #include <sstream>
diff --git a/test/aocl_vml.cpp b/test/aocl_vml.cpp
index 8a12899..16ded7b 100644
--- a/test/aocl_vml.cpp
+++ b/test/aocl_vml.cpp
@@ -13,11 +13,11 @@
 #ifdef EIGEN_TEST_AOCL_STUBS
 #include <cmath>
 #define EIGEN_TEST_AOCL_UNARY_STUB(NAME, FUNC)     \
-  static void NAME(int n, double* x, double* y) {  \
+  inline void NAME(int n, double* x, double* y) {  \
     for (int i = 0; i < n; ++i) y[i] = FUNC(x[i]); \
   }
 #define EIGEN_TEST_AOCL_BINARY_STUB(NAME, FUNC)              \
-  static void NAME(int n, double* x, double* z, double* y) { \
+  inline void NAME(int n, double* x, double* z, double* y) { \
     for (int i = 0; i < n; ++i) y[i] = FUNC(x[i], z[i]);     \
   }
 static double aocl_stub_add(double a, double b) { return a + b; }
diff --git a/test/trig_sign_fastmath.cpp b/test/trig_sign_fastmath.cpp
index 0503d61..57f3ad1 100644
--- a/test/trig_sign_fastmath.cpp
+++ b/test/trig_sign_fastmath.cpp
@@ -46,7 +46,7 @@
   static void run() {
     using Complex = std::complex<Scalar>;
     using Packet = typename internal::packet_traits<Complex>::type;
-    constexpr Index kSize = internal::unpacket_traits<Packet>::size;
+    constexpr Index kSize = internal::packet_traits<Complex>::size;
     const Index n = numext::maxi<Index>(32, kSize);
     std::vector<Complex> x(n), y(n);
     for (Index i = 0; i < n; ++i)