[Bug Report] assigning a `Solve` expression to a `IndexedView` expression gives wrong results

Assigning a Solve expression to a IndexedView expression gives wrong results with Eigen 3.4.0:

Code snippet to reproduce (avaliable on godbolt: link)

#include <iostream>
#include <Eigen/Dense>
#include <Eigen/Sparse>

int main() {
    // setup a poisson problem
    Eigen::SparseMatrix<float> A;
    Eigen::VectorXf rhs;
    {
        A.resize(4, 4);
        std::vector<Eigen::Triplet<float>> triplets = {
            {0, 0, 2},
            {1, 1, 2},
            {2, 2, 2},
            {3, 3, 2},
            {0, 1, -1},
            {1, 0, -1},
            {1, 2, -1},
            {2, 1, -1},
            {2, 3, -1},
            {3, 2, -1},
        };
        A.setFromTriplets(triplets.begin(), triplets.end());
        
        rhs.resize(4);
        rhs << 1,0,0,6;
    }
    
    // setup LDLT solver
    Eigen::SimplicialLDLT<Eigen::SparseMatrix<float>> solver;
    solver.compute(A);

    // 1. directly solve it, correct
    Eigen::VectorXf result;
    result = solver.solve(rhs);
    std::cout << "result 1:\n" << result << std::endl;

    // 2. solve it and assign to an indexed view, wrong
    std::vector<int> indices = {0,1,3,4};
    result = Eigen::VectorXf::Zero(5);
    result(indices) = solver.solve(rhs);
    std::cout << "result 2:\n" << result << std::endl;

    // 3 and 4: with a negetive sign
    result = Eigen::VectorXf::Zero(5);
    result(indices) = solver.solve(-rhs);
    std::cout << "result 3:\n" << result << std::endl;
    
    result = Eigen::VectorXf::Zero(5);
    result(indices) = -solver.solve(rhs);
    std::cout << "result 4:\n" << result << std::endl;
}

the output is as follow:

result 1: // this is correct
2
3
4
5
result 2: // this is wrong, the 4-th item should be 4
2
3
0
5
5
result 3: // this is also wrong, the 4-th item should be -4
-2
-3
 0
-5
-5
result 4: // this is correct, don't know why...
-2
-3
 0
-4
-5
Edited by Xiaosong Chen