Repository navigation
Clearer diagnostics, no output after an error, and two UBSan fixes. - #4
Merged
Merged
Conversation
Errors were printed as `file(line) : message` and warnings as `file(line) : warning: message`, so searching a build log for "error:" found nothing, and a failed VU build was easy to miss. Errors now read `file(line) : error: message`, or `openvcl: error: message` when they have no location. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Running out of registers printed only `openvcl: Register allocation ran
out of registers`, with no variable, register type or location, so
finding the pressure point meant bisecting the source. The error now
names the register type and how many registers .init_vf/.init_vi leave
to the allocator, and points at the first line that uses the variable
it could not place:
x.vcl(9) : error: Register allocation ran out of VI registers
(2 available) for iC (ilw.x >>> iC <<<, 2(vi00))
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When tokenizing reported an error (an invalid operand, say), openvcl exited with failure but still wrote the .vsm, minus the bad instruction. The fresh file then looked up to date to make, so the next build used it, and a VU change could seem not to take effect. Now nothing is written once an error has been reported, to a file or to stdout, and an existing output file is left as it was. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Tokenizer's constructor left m_newSyntax uninitialized. Parser always sets it before tokenizing, but the Tokenizer unit tests read it first (UBSan: "load of value 78, which is not a valid value for type 'bool'"). It now starts false, the default without -n. - The gasp temp-file name computed ((getpid() + rand()) << 8) in int, which overflows. It is now computed unsigned, which gives the same bits, so the same names, without the undefined behaviour. Found by building with -fsanitize=address,undefined and running the test suite and the PS2 examples; both reports are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four small changes, one commit each. This change only affects diagnostics and simple Sanitizer fixes.
1. Errors are now tagged
error:, as warnings are taggedwarning:. Errors were printed asfile(line) : message, so searching a build log for "error:" found nothing, and a failed VU build was easy to miss. Now:x.vcl(8) : error: Invalid argument (clipw.xyz fA, >>> fA[x] <<< [x ])Errors without a location read
openvcl: error: ....2. Running out of registers names the variable. The message was only
openvcl: Register allocation ran out of registers. It now gives the register type, how many registers.init_vf/.init_vileave to the allocator, and the first line that uses the variable that couldn't be placed:x.vcl(9) : error: Register allocation ran out of VI registers (2 available) for iC (ilw.x >>> iC <<<, 2(vi00))For example, Tyra's
stapip_cull_td_vu1, which only SCE vcl compiles, now accurately reports running out of VF registers (31 available) foroutputColor3at its line 171.3. A failed build writes no output. When tokenizing reported an error, openvcl exited with failure but still wrote the
.vsm, minus the bad instruction. The fresh file looked up to date tomake, so the next build used it. Now nothing is written once an error has been reported, to a file or to stdout, and an existing output file is left as it was.4. Two UBSan fixes, found by building with
-fsanitize=address,undefinedand running the tests and the PS2 examples:Tokenizer's constructor never initializedm_newSyntax.Parsersets it before tokenizing, but the Tokenizer unit tests read it first. It now startsfalse.(getpid() + rand()) << 8as anint, which overflows. It's now computedunsigned, which gives the same bits and so the same names.Testing
test/integration/test_diagnostics.cpp, 5 new test cases.🤖 Co-authored by Claude Code