Using `export' / `readonly' on a variable that's present in both the temp env and a calling function's local context combines the attributes of all the intervening scopes in the global variable:
$ declare -A v; f() { local -a v; v= e; }; e() { export v; } $ (f; declare -p v) declare -aAx v=([0]="") $ (f; v=) Segmentation fault: 11