If you take into account the amount of aircraft produced and hours flown. I think it’s the 777 by a long shot. Especially since the 777’s fatal accidents were all basically external factors. One got shot down(MH17), another one has basically vanished (MH370) and the last one the pilot couldn’t do a basic approach in clear weather (OZ214).
Pretty solid if you ask me.
And the two fatal crashes of A330 were also caused by a pilot's error.
Without turning this thread into another AF447 discussion, you can make your own conclusion as the final report is out there. The frozen pitot tubes didn't cause the crash, it merely caused the autopilot to disengage. The pilot manually stalled the plane and failed to recognized that he did for a long time even though the stall alarms were on. IMO, that's also an external factor as well.
As for A340, it has flown over 20 million hours with zero fatal crashes. Now, you might say that is considerably fewer hours that what the 777 has flown, which is true, but the A340 sample size is pretty big too. You can definitely club it into 'one of the safest planes ever made'.