A theoretical study of rare-gas diatomic molecules with the generalized-gradient approximation to density functional theory