Unfortunately for learners there is no rule or pattern to be found here. The "broadening" of the [a] to [ɑː] rather than flattening to [æ] always occurs before (silent) "r" (start, car) and sporadically before some fricatives (pass, father) but not always (mass, gather).
There is no rule that reliably predicts if an "a" will be broad, though the voiceless fricatives /f, θ, s/ are most likely to be preceded by a broad a, whereas the "sh" /ʃ/ is (almost) never (ash, crash).
Broadening seems to have occurred among lower-class English, mostly short common words have the broad "a", whereas long words, or words that were only used (then) in scientific or technical language don't show broadening (for example "gas" was a technical term in the 17th century)
This all means that a learner of RP pronunciation simply has to learn which words are produced with a broad "a". Fortunately, the flat "a" [æ] is very familiar (from Northern dialects and American English) so if you say [pæs] or [bæθ] you will be understood. Wikipedia has a list of words with the broad a