Staifour: F = GMm/d^2 is only applicable when you are outside a spherical object or a spherical shell.

If you dug a hole from the North to the South Pole, gravity would get weaker as you traveled toward the center. The mass above counteracts some of the mass below. The exact center is surrounded by a symmetric distribution of mass, causing all the forces to cancel. Of course, this makes certain assumptions about density and mass distribution being symmetric with respect to the center.

Note also that F = GMm/d^2 is not applicable to irregular shapes. It becomes a better and better approximation as the irregular objects move farther and farther apart, but is exact only for spherical objects.

Kedaman & Others: My calculus is too rusty to set up the integrands and do the integrations required to determine the potential functions. The following is an intuitive analysis of this problem.

Imagine a hollow sphere of radius R and a hollow parallelepiped both centered on the origin of an XYZ coordinate system. For simplicity, let the parallelepiped have the its top and bottom rectangles tangent to the North & South Poles of the sphere (Poles assumed to be on Z-Axis). The sides are assumed equidistant from the XZ-Plane, with the front & back equidistant from the YZ-Plane.

For purposes of the following discussion, the actual dimension do not matter, only the symmetries.

Imagine moving up and down the Z-Axis, staying inside the sphere and the box.
  • Both the sphere and the box are symmetric with respect to the Z-Axis. Therefore there is no net gravitational force in any direction parallel to the XY-Plane.
  • As the point moves toward the North Pole of the spherical shell, more of the mass of the shell is below the point and less is above. The point is closer to the mass above it and farther from the mass below it. Each bit of mass above being closer exerts more force. Each bit below exerts less due to be farther away. Intuition cannot determine the net effect of the greater mass farther away versus the nearer mass which is closer.
  • As the point moves toward the top of the box, it gets closer to all of the mass in the top and farther from all of the mass in the bottom. If the sides, front, and back of the box are distant from the origin compared to the top and bottom, they will contribute little force parallel to the Z-Axis.
To me, the above is a convincing argument indicating that there is a net gravitational force inside the box. The above is inconclusive as regards the sphere, but allows for the possibility of a zero field.

Those whose calculus is in better shape than mine, might want to consider the following.
Code:
Potential(x, y, z) = G*Integral(Density*dv / r)
GravitationalForce(x, y, z) = DirectionalDerivative[ Potential(x, y, z) ]
Where G is the gravitational constant, dv is an infinitesimal of volume, and r is the distance from (x, y, z) to the little piece of volume.

If the density is constant, it can be brought outside the integral as a multiplicative factor.

As mentioned above, my calculus is too rusty to deal with the above. I remember doing the work for a spherical shell as an exam question about 50+ years ago. I remember the potential being constant everywhere inside the shell. The derivative of a constant is zero, resulting in zero gravitational force inside the shell. The integral for outside the shell indicated that the shell acted as a point mass on external objects.

I do not remember any discussion of other hollow shapes, but my intuition strongly suggests that none have the zero gravity property of the hollow sphere. I am also pretty certain that only a spherical shell or a sphere act as point masses on external points. At large distances, any shape is usually treated as a point mass, but this is an approximation. The approximation is excellent at large distances, but questionable when close to irregular shapes.