  A mathematical derivation of the force exerted by an \emph{inhomogeneous}
(i.e., compressible) fluid on the surface of an \emph{arbitrarily-shaped} body
immersed in it is not found in literature, which may be attributed to our trust
on Archimedes' law of buoyancy. However, this law, also known as Archimedes'
principle (AP), does not yield the force observed when the body is in contact
to the container walls, as is more evident in the case of a block immersed in a
liquid and in contact to the bottom, in which a \emph{downward} force that
\emph{increases with depth} is observed. In this work, by taking into account
the surface integral of the pressure force exerted by a fluid over the surface
of a body, the general validity of AP is checked. For a body fully surrounded
by a fluid, homogeneous or not, a gradient version of the divergence theorem
applies, yielding a volume integral that simplifies to an upward force which
agrees to the force predicted by AP, as long as the fluid density is a
\emph{continuous function of depth}. For the bottom case, this approach yields
a downward force that increases with depth, which contrasts to AP but is in
agreement to experiments. It also yields a formula for this force which shows
that it increases with the area of contact.
