Skip to content

Commit c016de4

Browse files
leifericfclaude
andcommitted
v0.144.4: pass -Wno-clobbered to silence gcc, drop volatile
The v0.144.2 volatile annotations on env and rest miscompile the nested-try-rethrow path on Linux gcc: the outer catch sees the inner exception instead of the rethrown one. Apple clang's codegen for the same source is correct without volatile, so the v0.144.0-era source is fine. Reverts the volatile additions and instead passes -Wno-clobbered to the compiler, gated through -Wno-unknown-warning-option so Apple clang silently ignores the flag it doesn't recognise. The mino_current_ctx simplification from v0.144.3 (drop the unused local t) stays -- it is a style cleanup independent of the warning suppression. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 0e2e92c commit c016de4

4 files changed

Lines changed: 26 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Changelog
22

3+
## v0.144.4 — Build Fix: Suppress gcc's `-Wclobbered` Instead Of `volatile`
4+
5+
The v0.144.2 attempt to silence gcc's `-Wclobbered` by marking
6+
`mino_bc_run`'s `env` parameter and `rest` local `volatile`
7+
turned out to miscompile the nested-try-rethrow path on Linux
8+
gcc (the outer catch handler saw the inner exception instead
9+
of the rethrown one). Apple clang's codegen for the same source
10+
was correct without `volatile`. The simpler fix: pass
11+
`-Wno-clobbered` to the compiler (gated through
12+
`-Wno-unknown-warning-option` so clang silently ignores it). The
13+
volatile annotations are reverted; the codegen on both compilers
14+
now matches the v0.144.0-era source. The `mino_current_ctx`
15+
inline simplification from v0.144.3 (drop the unused local `t`)
16+
stays — it is a clean style cleanup independent of the warning.
17+
318
## v0.144.3 — Build Fix: Drop Local In `mino_current_ctx`
419

520
gcc's `-Werror=clobbered` flagged the local `t` in

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@
1212
# add it to the task runner instead.
1313

1414
CC ?= cc
15-
CFLAGS ?= -std=c99 -Wall -Wpedantic -Wextra -Werror -Wno-missing-field-initializers -O2
15+
# -Wno-clobbered silences a gcc-specific false positive in the bytecode VM
16+
# (mino_bc_run holds locals across setjmp/longjmp pairs; the warning is a
17+
# heuristic that doesn't reflect whether the value is actually re-read on
18+
# the longjmp branch). Apple clang doesn't emit this warning at all and
19+
# doesn't recognise the flag name, so the -Wno-unknown-warning-option
20+
# pair lets us pass -Wno-clobbered to both compilers without breaking
21+
# either.
22+
CFLAGS ?= -std=c99 -Wall -Wpedantic -Wextra -Werror -Wno-missing-field-initializers -Wno-unknown-warning-option -Wno-clobbered -O2
1623
INCDIRS = -Isrc -Isrc/public -Isrc/runtime -Isrc/gc -Isrc/eval \
1724
-Isrc/collections -Isrc/prim -Isrc/async -Isrc/interop \
1825
-Isrc/diag -Isrc/vendor/imath

src/eval/bc/vm.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,7 @@ static mino_val_t *resolve_global(mino_state_t *S, mino_val_t *sym,
238238
}
239239

240240
mino_val_t *mino_bc_run(mino_state_t *S, mino_val_t *fn_val,
241-
mino_val_t **argv, int argc,
242-
mino_env_t *volatile env)
241+
mino_val_t **argv, int argc, mino_env_t *env)
243242
{
244243
const mino_bc_fn_t *bc = fn_val->as.fn.bc;
245244
if (bc == NULL || bc->code == NULL) return NULL;
@@ -273,7 +272,7 @@ mino_val_t *mino_bc_run(mino_state_t *S, mino_val_t *fn_val,
273272
* we get the values in their original order. When argc ==
274273
* n_params the rest binding is the empty list. */
275274
if (match->has_rest) {
276-
mino_val_t *volatile rest = mino_nil(S);
275+
mino_val_t *rest = mino_nil(S);
277276
for (int i = argc - 1; i >= match->n_params; i--) {
278277
rest = mino_cons(S, argv[i], rest);
279278
if (rest == NULL) { bc_pop_window(S, base); return NULL; }

src/mino.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*/
2929
#define MINO_VERSION_MAJOR 0
3030
#define MINO_VERSION_MINOR 144
31-
#define MINO_VERSION_PATCH 3
31+
#define MINO_VERSION_PATCH 4
3232

3333
/*
3434
* Human-readable version string of the *linked* runtime, e.g. "0.48.0".

0 commit comments

Comments
 (0)