Throughout the Pali Canon you can find instances where the Buddha appears to engage in harsh speech that seems to be contrary to the noble eighfold path. There are several important points/possibilities to understand first:
It may just be the appearance of harsh speech, and not actually contrary to the path.
My understanding of harsh speech may be too gentle compared to what the Buddha intended, and rather the way he engages in what seems to be 'harsh speech' is the norm (or limit) of gentle speech.
The Suttas may be fabricated and inauthentic.
The Sutta in question may be authentic and the speech may be harsh, yet the Tathagata may be engaging in harsh speech because he knows the limits of all actions and cannot be reckoned by Karma.
There are (at least) several Sutta instances of the Buddha engaging in what would seem to me to be harsh speech. These examples are not common and they are hard to find without re-reading sections of the Pali Canon. Here is one that I remember off the top of my head:
"Of whom do you know, foolish man, that I have taught to him the teaching in that manner? Did I not, foolish man, speak in many ways of those obstructive things that they are obstructions indeed, and that they necessarily obstruct him who pursues them? Sense desires, so I have said, bring little enjoyment, and much suffering and disappointment. The perils in them are greater. Sense desires are like bare bones, have I said; they are like a lump of flesh... they are like a snake's head, have I said. They bring much suffering and disappointment. The perils in them are greater. But you, O foolish man, have misrepresented us by what you personally have wrongly grasped. You have undermined your own (future) and have created much demerit. This, foolish man, will bring you much harm and suffering for a long time."
Then the Blessed One addressed the monks thus: "What do you think, O monks: has that monk Ari.t.tha, formerly of the vulture killers, produced any spark (of understanding) in this teaching and discipline?"[4] — "How should that be, Lord? Certainly not, O Lord."
After these words the monk Ari.t.tha, formerly of the vulture killers, sat silent, confused, with his shoulders drooping and his head bent, brooding and incapable of making a rejoinder.
The Discourse on the Snake Simile
To me the tone of the speech is an example of harsh speech. If I were to use this kind of speech in my day-to-day life I would consider myself not living up to the standard of Right Speech as per the Noble Eightfold Path. I understand, however, that the Buddha controls his speech masterfully. In that case, how did this sort of speech come to be? There is no clause in 'Right Speech' that allows us to engage in harsh speech for the greater good - for example rebuking a monk harshly. That being said, do not mistake this for casting doubt on the Buddha. I consider him a good example of what everyone should act like and his control of virtue, faculties, and activities is something everyone should strive for.
Also, there are several more examples. I have read through chunks of the Pali Canon and there are other Suttas where the Buddha engages in speech I would again consider a violation of Right Speech (not that I have a perfect record of Right Speech). My question is why? Why not rebuke without harshness and adhere perfectly to gentleness?