diff options
| author | Alessandro Gatti <a.gatti@frob.it> | 2023-11-03 21:27:24 +0100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2024-07-23 15:51:50 +1000 |
| commit | 44527ada5f120f5f131bcd759e86e4e5323555aa (patch) | |
| tree | 010695147b3115ae17e0d9c3d8f5bd3e48dc01a3 | |
| parent | 594c4229b7aaa7b62ef2b24f47feeb7071714a0d (diff) | |
unix/main: Fix GCC builds for RISC-V 64 bits.
This contains a workaround to silence a possibly incorrect warning when
building the Unix port with GCC targeting RISC-V 64 bits.
Fixes issue #12838.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
| -rw-r--r-- | ports/unix/main.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ports/unix/main.c b/ports/unix/main.c index 79d1e88ad..d9ee6eec4 100644 --- a/ports/unix/main.c +++ b/ports/unix/main.c @@ -562,7 +562,12 @@ 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; + // GCC targeting RISC-V 64 reports a warning about `path_remaining` being clobbered by + // either setjmp or vfork if that variable it is allocated on the stack. This may + // probably be a compiler error as it occurs on a few recent GCC releases (up to 14.1.0) + // but LLVM doesn't report any warnings. + static bool path_remaining; + path_remaining = *path; while (path_remaining) { char *path_entry_end = strchr(path, PATHLIST_SEP_CHAR); if (path_entry_end == NULL) { |
