Not all compound nouns are masculine nouns, they can be feminine. Usually, compound nouns with a verb in them are masculine ("el abrelatas", "el girasol", "el quitamanchas", etc.), but there are feminine ones, too: "la aguzanieves", "la cortapisa", etc.
There is a rule not respected (so, I'm not sure that it is a rule
) that the last noun gives the gender to the compound noun, so "el mediodía" would be affected by the masculine noun of "día" (el día). So, we have the following feminine nouns: "aguamarina", "avemaría", "telaraña", "aguanieve", "bocamanga", etc.
However, there are much more masculine compound nouns than feminine ones.