lesgourg / class_public

Public repository of the Cosmic Linear Anisotropy Solving System (master for the most recent version of the standard code; GW_CLASS to include Cosmic Gravitational Wave Background anisotropies; classnet branch for acceleration with neutral networks; ExoCLASS branch for exotic energy injection; class_matter branch for FFTlog)
230 stars 285 forks source link

segfault in class v2.9 when computing A_s given sigma8 #310

Closed emiliobellini closed 4 years ago

emiliobellini commented 4 years ago

Hi all, I think I found a small bug that can cause segmentation fault in v2.9 of Class. This is a minimal input that allows to reproduce it

output = mPk sigma8 = 0.8

I tracked down the error and it is raised at line 939 of perturbations.c. The code tries to free ppt->beta_idr but it's not defined. A quick and dirty workaround is to comment that line, but clearly it is not ideal. To be more specific, this error happens at the end of the function "input_try_unknown_parameters", when the code tries to free the structures after the shooting. It is interesting to notice that commenting out "sigma8 = 0.8" the code runs well. So, apparently if perturb_free is called after a normal evaluation of perturbations Class is happy. Can this be a compiler dependent thing? (mine is gcc 7.4.0 on Ubuntu 18.04) Also, I do not understand why ppt->alpha_idm_dr is not giving the same error, but probably in some cases it could..

Cheers, Emilio

lesgourg commented 4 years ago

Many thanks Emilio for noticing this! This has been corrected a few weeks ago in 2.9.1. Best, Julien