  A hypothesis for sunspot formation is the buoyant emergence of magnetic flux
tubes created by the strong radial shear at the tachocline. In this scenario,
the magnetic field has to exceed a threshold value before it becomes buoyant
and emerges through the whole convection zone. We follow the evolution of a
random seed magnetic field with the aim of study under what conditions it is
possible to excite the dynamo instability and whether the dynamo generated
magnetic field becomes buoyantly unstable and emerges to the surface as
expected in the flux-tube context. We perform numerical simulations of
compressible turbulent convection that include a vertical shear layer. Like the
solar tachocline, the shear is located at the interface between convective and
stable layers. We find that shear and convection are able to amplify the
initial magnetic field and form large-scale elongated magnetic structures. The
magnetic field strength depends on several parameters such as the shear
amplitude, the thickness and location of the shear layer, and the magnetic
Reynolds number ($\Rm$). Whenever the toroidal magnetic field reaches
amplitudes greater a threshold value which is close to the equipartition value,
it becomes buoyant and rises into the convection zone where it expands and
forms mushroom shape structures. Some events of emergence, i.e. those with the
largest amplitudes of the initial field, are able to reach the very uppermost
layers of the domain. These episodes are able to modify the convective pattern
forming either broader convection cells or convective eddies elongated in the
direction of the field. However, in none of these events the field preserves
its initial structure.
