Repository navigation
with migrate: an extern global the unit only declares is raw: its read and write print inside unsafe, and an extern array of unknown size is indexed as a pointer (#3344) - #3353
Merged
Conversation
…nsafe when it is neither const nor thread-local, and an extern array of unknown size is indexed as the pointer it is declared as (#3344)
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.
A file-scope variable the migrated unit only declares, and no unit of the migration defines, is emitted
extern var/extern let. A body that names it reads or writes a C global: raw unless it isconstor thread-local (§31.4), and an array of unknown size is declared as a pointer, so its index is a raw index. The bodies were emitted bare and the output did not check (E0921; "raw pointer indexing requires unsafe context").now migrates to
A
constscalar extern and a global the unit defines are unchanged.ci_migrate_collect_extern_vars(beside the collector for unsafe extern functions, with its std-zone exemption) names the variables per unit; the printer wraps a read (unsafe { name }), a statement-level write (the whole assignment), and the index of a pointer-declared extern, and prints them bare inside anunsafe fn.Test:
behav_3344_migrate_extern_global_is_raw(fails on the installed compiler, passes here; the migrated file must check).Battery: GREEN. The run before it was red on
unit-return-review(an explicit-> Uniton a new function; removed) and onpub-lint-check, whose analysis step timed out under machine load (by hand it reports nothing).Still open on #3344:
with migrate <dir>does not run the check the single-file form runs.