Catechism of the Catholic Church 1737
An effect can be tolerated without being willed by its agent; for instance, a mother's exhaustion from tending her sick child. A bad effect is not imputable if it was not willed either as an end or as a means of an action, e.g., a death a person incurs in aiding someone in danger. For a bad effect to be imputable it must be foreseeable and the agent must have the possibility of avoiding it, as in the case of manslaughter caused by a drunken driver.
Catechism of the Catholic Church 1756
... There are acts which, in and of themselves, independently of circumstances and intentions, are always gravely illicit by reason of their object; such as blasphemy and perjury, murder and adultery. One may not do evil so that good may result from it. [intrinsically evil means are different than unwilled effects]
"One may not do evil that good may come of it," is an ancient axiom of morality. As noted under the subject of moral cooperation, we may not formally will another’s evil, provide immediate material support for it, or even mediate material support. We may, however, tolerate it as remote mediate material cooperation, but only when there is a serious proportion, as discussed under no. 4 below.
Such unintended evil effects are morally different than using evil means to achieve an end. Something that is used as a means is by its nature intended.