In some dictionaries, I see words like talamh marked as being both masculine and feminine (see https://www.teanglann.ie/en/fgb/talamh for instance). Why is this? Is this just a dialectal variation?
In the particular case of talamh, it was originally a masculine noun, but in Early Modern Irish a feminine version with different inflections arose, and both genders and their differing genitive singular forms are still used. The genders of some other words have changed over time; for example, the “fairy mound” sí used to be feminine (and is still feminine in some placenames and in the expression ríocht na sí ), but it’s shown as being masculine in the FGB.
With an article, oiread is treated as a feminine noun, except in the genitive, when it is treated as a masculine noun (e.g. in the genitive singular, it takes masculine genitive singular attributive adjectives; but in the non-genitive singular, its attributive adjectives are not lenited). It takes the masculine singular possessive adjective a.
In the cases of words like sú, where the masculine words mean “juice” and “absorption” and the feminine word means “berry”, the words are homographs; they’re different words with the same spelling. (The two masculine words have different genitive singular forms; the “juice” and “berry” words have different plural forms, and the “absorption” word doesn’t have a plural form. Before the 1950s spelling reform, each word had a different spelling; the masculine words came from different Latin roots.)