The presence of CO gas around 10-50 Myr old A stars with debris discs has sparked debate on whether the gas is primordial or secondary . Since secondary gas released from planetesimals is poor in H _ { 2 } , it was thought that CO would quickly photodissociate never reaching the high levels observed around the majority of A stars with bright debris discs . [ ] showed that neutral carbon produced by CO photodissociation can effectively shield CO and potentially explain the high CO masses around 9 A stars with bright debris discs . Here we present a new model that simulates the gas viscous evolution , accounting for carbon shielding and how the gas release rate decreases with time as the planetesimal disc loses mass . We find that the present gas mass in a system is highly dependant on its evolutionary path . Since gas is lost on long timescales , it can retain a memory of the initial disc mass . Moreover , we find that gas levels can be out of equilibrium and quickly evolving from a shielded onto an unshielded state . With this model , we build the first population synthesis of gas around A stars , which we use to constrain the disc viscosity . We find a good match with a high viscosity ( \alpha \sim 0.1 ) , indicating that gas is lost on timescales \sim 1 - 10 Myr . Moreover , our model also shows that high CO masses are not expected around FGK stars since their planetesimal discs are born with lower masses , explaining why shielded discs are only found around A stars . Finally , we hypothesise that the observed carbon cavities could be due to radiation pressure or accreting planets .