I'd love to hear people's views on whether it was actually possible for Gibraltar to fall. It seems like there was some pretty impressive sieges of it in our timeline, but the place seems impenetrable.
I think the physical impregnability of Gibraltar was relevant before the 20th century; then Britain would often be at war with powers that held the land approaches but their defenses were adequate and the British could rely on resupplying the fortress by sea, so attacks were futile.
I think nowadays the real defense of Gibraltar is geopolitical strategy rather than the Rock being absolutely untakable in theory.
My impression is that with modern (ie 20th century) artillery and control of all the approaches by land, with the artillery and aircraft also suppressing attempts to relieve Gibraltar by air or sea, at least the place could be besieged and eventually starved out. I don't know how much a constant battering by heavy artillery and bombing could actually crack the inner defenses.
So what you need is a Spain willing to pay the price of British hostility (and whatever allies Britain may have) which would be severe, as the British would cut off Spanish trade--by the WWII era Spain was dependent on imported petroleum for instance. And either Spain herself or some ally has a top-rate artillery and air force capability.
Evidently Franco was not willing to suffer the costs of alienating the Allies that much--it may have figured in his decisions that if he offered Hitler the chance to neutralize the Rock, it would be Hitler and not him left in de facto control of the strong point, whatever it might say on paper. But probably most important would be how much Spain would suffer with its access to world trade cut off.
So if British power were generally reduced to the point they couldn't control shipping to Spain, and Britain had no allies who could or would, then Spain trying to take it back by force might become a possibility.
Or, any power that could actually conquer Spain might then push on to take Gibraltar, if they didn't care about starting a war with Britain. Presumably they'd already be in one, and if they tried invading Spain the British or their allies would offer to help Spain fight off said invaders, so they'd likely be at war with Britain anyway by the time they got to Gibraltar.