  (abridged)Prompt GRB emission is often interpreted as synchrotron radiation
from high-energy electrons accelerated in internal shocks. Fast synchrotron
cooling predicts that the photon index below the spectral peak is alpha=-3/2.
This differs significantly from the observed median value alpha \approx -1. We
quantify the influence of inverse Compton and adiabatic cooling on alpha to
understand whether these processes can reconcile the observations with a
synchrotron origin. We use a time-dependent code that follows both the shock
dynamics and electron energy losses. We investigate the dependence of alpha on
the parameters of the model. Slopes between -3/2 and -1 are reached when
electrons suffer IC losses in the Klein-Nishina regime. This does not
necessarily imply a strong IC component in the Fermi/LAT range because
scatterings are only moderately efficient. Steep slopes require that a large
fraction (10-30%) of the dissipated energy is given to a small fraction (<~1%)
of the electrons and that the magnetic energy density fraction remains low (<~
0.1%). Values of alpha up to -2/3 can be obtained with relatively high
radiative efficiencies (>50%) when adiabatic cooling is comparable with
radiative cooling (marginally fast cooling). This requires collisions at small
radii and/or with low magnetic fields. Amending the standard fast cooling
scenario to account for IC cooling naturally leads to alpha up to -1.
Marginally fast cooling may also account for alpha up to -2/3, although the
conditions required are more difficult to reach. About 20% of GRBs show spectra
with slopes alpha>-2/3. Other effects, not investigated here, such as a thermal
component in the electron distribution or pair production by HE photons may
further affect alpha. Still, the majority of observed GRB prompt spectra can be
reconciled with a synchrotron origin, constraining the microphysics of mildly
relativistic internal shocks.
