ESP32 timed Light sleep + momentary wake up with button

I don't believe that the real cause for the crash is making the variable global.
Sure if you say the code crashes the code crashes. But I suspect that there is something else wrong with the code which when the variable is defined local has not the effect of crashing. One possible cause could be some kind of memory-corruption that happens on different places depending on the variable beeing declared global or local.

It would be very interesting to know at exact what line of code the code crashes.
This can easily be done by adding serial prints to the code.
best regards Stefan