$ bash -c 'unset X; declare -n SHLVL=X[-1]; /'
...
SUMMARY: AddressSanitizer: SEGV variables.c:892 in adjust_shell_level
---
variables.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/variables.c b/variables.c
index dc74855b..1f9b32c3 100644
--- a/variables.c
+++ b/variables.c
@@ -889,7 +889,8 @@ adjust_shell_level (int change)
}
temp_var = bind_variable ("SHLVL", new_level, 0);
- set_auto_export (temp_var);
+ if (temp_var)
+ set_auto_export (temp_var);
}
static void
--
2.54.0