Context. Solar gravity modes (g modes) are buoyancy waves that are trapped in the solar radiative zone and have been very difficult to detect at the surface. Solar g modes would complement solar pressure modes (p modes) in probing the central regions of the Sun, for example the rotation rate of the core. Aims. A detection of g modes using changes in the large frequency separation of p modes has recently been reported. However, it is unclear how p and g modes interact. The aim of this study is to evaluate to what extent g modes can perturb the frequencies of p modes. Methods. We computed the first-order perturbation to global p-mode frequencies due to a flow field and perturbations to solar structure (e.g. density and sound speed) caused by a g mode. We focused on long-period g modes and assumed that the g-mode perturbations are constant in time. The surface amplitude of g modes is assumed to be 1 mm s −1 , which is close to the observational limit set by Doppler observations. Results. Gravity modes do perturb p-mode frequencies to first order if the harmonic degree of the g mode is even and if its azimuthal order is zero. The effect is extremely small. For dipole and quadrupole p modes, all frequency shifts are smaller than 0.1 nHz, or 2 × 10 −8 in relative numbers. This is because the relative perturbation to solar structure quantities caused by a g mode of realistic amplitude is of the order of 10 −6 to 10 −5 . Additionally, we find that structural changes dominate over advection. Surprisingly, the interaction of g and p modes takes place to a large part near the surface, where p modes spend most of their propagation times and g modes generate the largest relative changes to solar structure. This is due to the steep density stratification, which compensates the evanescent behaviour of g modes in the convection zone.Conclusions. It appears to be impossible to detect g modes solely through their signature in p-mode frequency shifts. Whether g modes leave a detectable signature in p-mode travel times under a given observational setup remains an open question.