The spin-1/2 J1–J2 Heisenberg antiferromagnet on the square lattice: Exact diagonalization for N=40 spins