You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bend -o: a $CC that is not a runnable clang is skipped silently, and the build uses plain clang #1802
CC="clang -mavx2" bend prog.bend -o prog # flags in $CC, as make and most build systems take it
CC=/usr/bin/clang-1 bend prog.bend -o prog # a path that does not exist
CC=gcc bend prog.bend -o prog # a compiler that is not clang
What happened
All three exit 0 with no output, and the binary is built by plain clang (readelf -p .comment shows clang version 23.1.3 for all three; on a larger program, CC="clang -mavx2" gives a binary with no ymm instruction, while a wrapper script that runs clang -mavx2 "$@", set as CC, gives 8,093). Nothing tells the user that the $CC they set was not used.
cc_find in bend2/main.ts tries $CC, then clang, then every clang-NN on PATH, running each name with spawnSync (no shell) and taking the first whose --version is clang 14 or newer. A $CC that cannot run, or is not clang, is pushed to the list that the final error prints, but that error only appears when no candidate works, so when plain clang works the skip is silent. It is the same on main at 40402b4.
I am not asking for compiler flags again (#1461 settled that: bend f.bend -o f.c and clang by hand works, and so does a wrapper script set as $CC). The issue is only the silence. Either of these would fix it:
fail when $CC is set and cannot be used, as the user asked for that compiler: the existing error already has the words (found <CC>, which is not clang);
or keep going with the next candidate, but print one line first, e.g. bend: $CC ("clang -mavx2") is not a runnable clang 14+; building with clang.
Why I hit it: building the emitted C of a training step for the host (-march=native) made it 12.5% faster on one thread with the same bits, and setting CC with the flag was the first thing I tried. It looked like it worked.
Activity
A $CC that is not a usable clang warns and falls back, instead of end…
bend -o: a $CC that is not a usable clang ends the build, instead of …