Commit 9f706cd
committed
fix(toolchain): store multi-token dialect flags as tokens, not a string to split
macOS CI segfaulted on every build.mcpp test. The crash was inside
`contract_env` — a function this branch never touched — corrupting a local
vector before the compile even started, and it reproduced only under
clang/libc++, never under GCC.
Bisecting with a clean target and dep cache each round (a first attempt was
worthless: switching mcpp.toml's toolchain without clearing the dependency
cache links a libstdc++-built mcpplibs.cmdline into a libc++ mcpp, which
crashes for an entirely unrelated reason) narrowed it to a single addition:
the `split_ws` helper. Not a call to it — its mere PRESENCE in the anonymous
namespace. Deleting it fixed the crash; a trivial unused function in the same
spot did not cause one. That is a clang codegen problem, not a logic error,
and no amount of reading the diff would have found it.
The fix is also the better design. `split_ws` only existed because the
dialect table stored "-x c++" and "/nologo /EHsc /utf-8" as ninja-command
strings while the build.mcpp path needs argv tokens — so the token boundary
was being re-derived at the call site. The table now carries both forms, the
argv one as a span over a static array, and the spelling stays in one row.
Verified under BOTH toolchains from a clean target and cache: clang 22.1.8
(e2e 89 / 92 / 179 / 181 all pass, previously all segfaults) and GCC 16.1.0
(unit 49/49).1 parent 3345242 commit 9f706cd
2 files changed
Lines changed: 23 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | 107 | | |
124 | 108 | | |
125 | 109 | | |
| |||
859 | 843 | | |
860 | 844 | | |
861 | 845 | | |
862 | | - | |
| 846 | + | |
863 | 847 | | |
864 | 848 | | |
865 | 849 | | |
| |||
871 | 855 | | |
872 | 856 | | |
873 | 857 | | |
874 | | - | |
| 858 | + | |
875 | 859 | | |
876 | 860 | | |
877 | 861 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| |||
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
45 | 55 | | |
| 56 | + | |
46 | 57 | | |
47 | 58 | | |
48 | 59 | | |
| |||
95 | 106 | | |
96 | 107 | | |
97 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
98 | 115 | | |
99 | 116 | | |
100 | 117 | | |
| |||
105 | 122 | | |
106 | 123 | | |
107 | 124 | | |
| 125 | + | |
108 | 126 | | |
109 | 127 | | |
110 | 128 | | |
| 129 | + | |
111 | 130 | | |
112 | 131 | | |
113 | 132 | | |
| |||
130 | 149 | | |
131 | 150 | | |
132 | 151 | | |
| 152 | + | |
133 | 153 | | |
134 | 154 | | |
135 | 155 | | |
| 156 | + | |
136 | 157 | | |
137 | 158 | | |
138 | 159 | | |
| |||
0 commit comments