first of all i dont think it does, many non-marxist socialists in the past were devout catholics. and the church has developed left-wing ideologies of it’s own, such a distributionism and corporatism.
second even if it does, it doesnt make it correct. this is why the church should just stick to theology and philosophy, because the sad truth is that the church’'s understanding of the economy, state, and politics have always been limited. i have studied socialist philosophies, and i must point out that communism is a STATELESS society, so the notion that its “totalitarian” is incorrect. yes its true that in communism theory and practice are two different things, but if we focus on theory, then communism is stateless. although communism is still intrinsically flawed because its based on class conflict. but the fact is that we NEED the state to step in and regulate private property. and yes, there must be some degree of profit sharing, because its the worker after all who builds up the nation, not the factory owner.
by the way, the church probably only condemned socialism, because of its ties to atheism.