In the recent literature, the g-subdiffusion equation involving Caputo
fractional derivatives with respect to another function has been studied in
relation to anomalous diffusions with a continuous transition between different
subdiffusive regimes. In this paper we study the problem of g-fractional
diffusion in a bounded domain with absorbing boundaries. We find the explicit
solution for the initial-boundary value problem and we study the first passage
time distribution and the mean first-passage time (MFPT). An interestin outcome
is the proof that with a particular choice of the function $g$ it is possible
to obtain a finite MFPT, differently from the anomalous diffusion described by
a fractional heat equation involving the classical Caputo derivative.