Repository navigation
Conversation
s[i] on a string had no element type in the MLIR emitter, which refused
the program ("index into a pointer of unknown element type"). The
checker types it u8 (#1147) and the C backend reads a byte; the emitter
now does the same, so the load is an unsigned i8.
Fixture: compiler/fixtures/mlir/string_index.flow.
…#1587) Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: godofecht <[email protected]>
Resolve merge conflicts in flowc_stage_a.c and corpus.txt. Regenerate docs. Regenerate bootstrap C. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: godofecht <[email protected]>
|
Resolved against current main in merge commit |
|
Superseded by merged #1665 (merge commit e3a9361), which explicitly migrates this MLIR string-indexing fix onto main with regenerated bootstrap and UTF-8 regression coverage. #1665's exact-head full CI and Linux/macOS qualification completed successfully. Closing the historical PR to avoid a duplicate/conflicting merge; its branch and commits remain preserved for reference. |
Pull request was closed
Cause
Indexing a string (
s[i]) gave the MLIR emitter no element type, so itrefused the program with "unsupported: index into a pointer of unknown
element type". The checker types
s[i]as u8 since #1147, and the Cbackend reads a byte. 5 corpus programs stopped there, among them
tests/lang/test_string_index_type.flow,examples/rosetta/string-reversal.flowand the
mlir_async,mlir_pipelineandmlir_static_memorytools(through their imports).
Fix
mlg_expr_ftgives the index of astringthe type u8. The load is thenan i8 marked unsigned, so a byte above 127 widens to a positive value, as
in C. Stores through
s[i]take the same path.Regression fixture:
compiler/fixtures/mlir/string_index.flow(bytes of anASCII string, a sum over them, and the two bytes of "é", which must read
195 and 169). On main it fails with "unsupported: index into a pointer of
unknown element type".
Counts
mlir_vs_c --onlyon the 5 affected programs:Full corpus run (
mlir_vs_c --jobs 8): queued behind the machine-wide corpus lock; the before and after counts will be added here.Gates
bootstrap_from_c.sh --regen, then--verify: PASSmlir_math_override, which fails in itsC-backend half (
flow run --backend=cexits 1). This change touches onlythe MLIR emitter, so the C path is the same as on main.
Regenerated state
compiler/bootstrap/flowc_stage_a.candcompiler/bootstrap/flowc_stage_a,in their own last commit.
compiler/fixtures/mlir/string_index.mlirand.out, recorded withparity_mlir.flow --record.compiler/fixtures/mlir/corpus.txt: two digests added, forexamples/rosetta/string-reversal.flowandtests/lang/test_string_index_type.flow, which flowc now accepts; no existing digest moved.--recordalso wanted to add 11 programs this change does not affect (corpus drift on main); those lines are left out.Risk
Low. Only string indexing changes, and it was refused before.
Needs review by a CODEOWNER (touches compiler/).