Skip to content

Triage the 84 pointer/width truncation warnings in the iOS port and ParparVM runtime #5781

Description

@shai-almog

These are the census rows most likely to be real 64-bit defects rather than
tidiness, so they are worth separating from the unused-symbol cleanup:

instances flag group
74 -Wshorten-64-to-32 port
4 -Wshorten-64-to-32 runtime (nativeMethods.m)
6 -Wpointer-to-int-cast runtime (nativeMethods.m, cn1_globals.m)

-Wpointer-to-int-cast here reads "cast to smaller integer type" -- a
pointer being narrowed, which silently corrupts any address above 4GB. The
-Wshorten-64-to-32 rows are "implicit conversion loses integer precision".

Each site needs reading rather than a blanket cast: the right answer is
sometimes to widen the destination, sometimes to route through uintptr_t, and
sometimes the value genuinely is bounded and an explicit cast documents that.
An added cast that merely silences the diagnostic without establishing the bound
is worse than the warning, because it removes the evidence.

Related, already fixed and useful as a model: the IOSNative.m and
cn1_globals.m pointer/integer conversions retired earlier in this work went
through (JAVA_LONG)(uintptr_t) rather than a direct cast.

Also in this family but smaller: -Wpointer-sign (7), -Wnonnull (4),
-Wincompatible-pointer-types (6), -Wmismatched-parameter-types (1).

Found by the native warning census (scripts/check-native-warnings.py).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions