Skip to content

v7.4.0

Choose a tag to compare

@github-actions github-actions released this 29 Nov 04:06
· 36 commits to dev since this release
68f93ef

Added

  • A run-time index into a [N]T, directly or through a *[N]T as (@p)[i], traps where the run-time checks are on when it is not below N, and a range x[start, count] with a run-time start traps when start + count is past N. A signed index is checked as negative and too large alike. p[i] on a bare *T carries no length and is not checked. ?a[i] with i == N traps as a constant ?a[N] is refused, and an end pointer is formed from the first element's address, ?first[N] where first is ?a[0], which indexes a pointer and is not checked. A tripped check is the target's trap instruction and prints nothing: natively the process dies of an illegal-instruction signal, SIGILL or on Windows STATUS_ILLEGAL_INSTRUCTION, and under WebAssembly it is a trap of the runtime. With debug info on, the trap carries the indexing line (#5093).
  • A profile takes an optional boolean checks. Stated, it decides both run-time checks, the index check and the tag payload check, whatever optimize and debug say. Not stated, the checks are on where the profile does not optimise and the target can trap, which is when the tag payload check ran before. build, test and check take --checks and --no-checks, and --set checks=true or --set checks=false states it. In a project the lever changes the profile, so it needs -o or -w, as -O does. mach init does not write the key. A manifest that states it needs mach 7.4.0 or later, since earlier releases refuse it as manifest.unknown_key (#5093).

Changed

  • Breaking: a debug build, or any profile that does not optimise and states no checks, now checks run-time array indices. A program that indexed past an array in such a build and happened to work now traps there. Release builds are unchanged unless they state checks = true (#5093).
  • A target whose unreachable is undefined behaviour takes no run-time checks. On vulkan SPIR-V an unoptimised build no longer emits the tag payload check, whose failure arm was an OpUnreachable the SPIR-V specification leaves undefined if executed, so a wrong-case payload read is unchecked there, and so is a run-time index. A profile, --set or --checks stating checks = true for that target is refused where it is stated as target.unsupported_op. checks = false is accepted on every target (#5093).
  • Builds against mirl 0.7.0, masc 0.2.4, mink 0.3.0 and std 10.3.0.

Fixed

  • On vulkan SPIR-V a narrow run-time array index, as a u8 made from a wider value, addressed the wrong element. An index is now widened there as on every other target, with zeros for an unsigned type and its sign for a signed one (#5100). Through mirl 0.7.0 a narrow value carried in a wider one is also made exact before it is used as an index, an offset, a length or a switch selector.
  • In an entry build, a single file with no manifest, --set beat the command line's levers, so --set optimize=false -O built unoptimised. The lever now wins, as the manifest reference's order says and as a project build always did. The same holds for --debug and --checks over --set debug= and --set checks= (#5093).

Issues resolved (2)

  • #5093 Check run-time indices against a stated length, under an optional profile key checks
  • #5100 SPIR-V hands ptr.index a narrow index unwidened, so a u8 of 128 or more is negative