Prevent integer overflow in datatype creation. Patch based on 
Gilles Gouaillardet solution attached to ticket #4145.

Closes #4145.
cmr=v1.7.4:reviewer=ompi-rm1.7
cmr=v1.6.6:reviewer=ompi-rm1.6