From 26d66dd57be5db8ea55519d2503b01294d7e3359 Mon Sep 17 00:00:00 2001 From: Alessandro Gatti Date: Fri, 3 Nov 2023 21:27:24 +0100 Subject: [PATCH] unix/main: Fix build on RISC-V 64 bits. A variable needed to be marked as static to make gcc on RISC-V build the Unix port. Fixes bug #12838. Signed-off-by: Alessandro Gatti --- ports/unix/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/unix/main.c b/ports/unix/main.c index 468fc40964..173bdf9986 100644 --- a/ports/unix/main.c +++ b/ports/unix/main.c @@ -562,7 +562,11 @@ MP_NOINLINE int main_(int argc, char **argv) { // First entry is empty. We've already added an empty entry to sys.path, so skip it. ++path; } - bool path_remaining = *path; + // Allocating path_remaining on the stack can lead to compiler warnings about this + // variable being clobbered when nlr is implemented using setjmp/longjmp. Its + // value must be preserved across calls to setjmp/longjmp. + static bool path_remaining; + path_remaining = *path; while (path_remaining) { char *path_entry_end = strchr(path, PATHLIST_SEP_CHAR); if (path_entry_end == NULL) {